balkan7 Posted June 15, 2008 Share Posted June 15, 2008 Hi guys, i have created function for show and hide rating in downloads so code not working propertly. code is: <?php echo "<script type='text/javascript' language='JavaScript'> function showhide(id){ if (document.getElementById){ obj = document.getElementById(id); if (obj.style.display == 'none'){ obj.style.display = ''; } else { obj.style.display = 'none'; } } } </script>"; echo "<tr>\n<td width='30%' class='tbl2'><b>Ratings:</b> \n<a href='#' onClick='showhide('".$data['download_id']."_ratings'); return(false);'><img src='".IMAGES."ratings.png' border='0' title='Ratings' alt='Ratings' /></a></td>\n</tr>"; echo "<div id='".$data['download_id']."_ratings' style='display:none;'> ".showratings("D", $data['download_id'], FUSION_SELF."?cat_id=$cat_id&download_id=".$data['download_id'])."</div>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/ Share on other sites More sharing options...
.josh Posted June 15, 2008 Share Posted June 15, 2008 php doesn't parse javascript. your browser does. php just spits it out to your browser. Now, "It doesn't work" could mean that your variables aren't echoing what you want them to (I do see some $'s in there, which makes them php vars) but I don't see where you are setting them in the first place. You're going to have to be more specific about "it doesn't work." Is the data there, but it's just not showing/hiding? That's a javascript problem. Variables shooting blanks? Possibly php, possibly javascript. But again, you have to be more specific. Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566061 Share on other sites More sharing options...
balkan7 Posted June 15, 2008 Author Share Posted June 15, 2008 maybe, now just show me ratings not hidding link in picture not working, and now when i try to rate one download rate everyone from that category, strange. i have set variable for show id to div tags and open from download id. what wrong here i dont know Soryy for bad english Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566064 Share on other sites More sharing options...
balkan7 Posted June 15, 2008 Author Share Posted June 15, 2008 dump ??? Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566092 Share on other sites More sharing options...
.josh Posted June 15, 2008 Share Posted June 15, 2008 ...well, you didn't really answer my question...what exactly is the problem? Do you see your data or not? Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566133 Share on other sites More sharing options...
balkan7 Posted June 16, 2008 Author Share Posted June 16, 2008 Soryy Crayon Violent, yes i see data from onClick='showhide('".$data['download_id']."_ratings'); i tryed whit many modifycation but nothing again, when i rate one from download rating all downloads. Exactly problem is not working link on image, this tag is opened not hidden -> <div id='".$data['download_id']."_ratings' style='display:none;'>. Exactly doesn't work, where i wrong ? Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566477 Share on other sites More sharing options...
.josh Posted June 16, 2008 Share Posted June 16, 2008 alright then. Since you're seeing data then it's not a php problem it's a javascript problem. moving thread. Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566484 Share on other sites More sharing options...
balkan7 Posted June 16, 2008 Author Share Posted June 16, 2008 any idea ? Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-566496 Share on other sites More sharing options...
balkan7 Posted June 17, 2008 Author Share Posted June 17, 2008 why java script wont work ? Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-567297 Share on other sites More sharing options...
balkan7 Posted June 22, 2008 Author Share Posted June 22, 2008 guys how can i get real id from open it for vote, if i vote only vote id=1, i need help to get id from show rating in div tag: <?php echo "<script type='text/javascript' language='JavaScript'> function showhide(id){ if (document.getElementById){ obj = document.getElementById(id); if (obj.style.display == 'none'){ obj.style.display = ''; } else { obj.style.display = 'none'; } } } </script>"; echo "<tr>\n<td width='30%' class='tbl2'><b>Ratings:</b> \n<a href='#' onClick='showhide('".$data['download_id']."_ratings')'><img src='".IMAGES."ratings.png' border='0' title='Ratings' alt='Ratings' /></a></td>\n</tr>"; echo "<div id='".$data['download_id']."_ratings' style='display:none;'> ".showratings("D", $data['download_id'], FUSION_SELF."?cat_id=$cat_id&download_id=".$data['download_id'])."</div>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/#findComment-571681 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.