Jump to content

Recommended Posts

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>";
?>

Link to comment
https://forums.phpfreaks.com/topic/110328-using-java-script-in-php-help/
Share on other sites

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. 

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

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 ?

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>";
?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.