taith Posted January 18, 2008 Share Posted January 18, 2008 anyone know why this wont work? (variables come from php) $rk is the identifying key, and $r[id] is an identifying id, $cb is tells us if its hidden or not... <a href="javascript:hidecell('.$rk.','.$r[id].');" style="font-size:20px;font-weight:700;">'.$cp.'</a> <td colspan=2 style="display:'.$cb.';" id="'.$rk.'">test</td> <script> function hidecell(key,id){ var el=getObject(key); if(el.style.display=='none'){ setcookie("forumcategories["+id+"]","shown"); this.innerHTML='-'; el.style.display='block'; }else{ setcookie("forumcategories["+id+"]","hidden"); this.innerHTML='+'; el.style.display='none'; } } </script> Link to comment https://forums.phpfreaks.com/topic/86566-solved-javascript-hider/ Share on other sites More sharing options...
taith Posted January 18, 2008 Author Share Posted January 18, 2008 ohya! i dont get any javascript errors... but when i alert(this.innerHTML); it says its undefined... and the -/+ wont switch... Link to comment https://forums.phpfreaks.com/topic/86566-solved-javascript-hider/#findComment-442311 Share on other sites More sharing options...
phpQuestioner Posted January 18, 2008 Share Posted January 18, 2008 Take out your php and just post static html (for demo purposes only). I see where you are referencing your "key" parameter, but I do not see where you are referencing your "id" parameter. Post a static html example of your code; so I can take a better look at it. Link to comment https://forums.phpfreaks.com/topic/86566-solved-javascript-hider/#findComment-442496 Share on other sites More sharing options...
roshanbh Posted January 18, 2008 Share Posted January 18, 2008 i think you've to put the php tag <?php ?> in the variable used i.e. variable should be replaced by <?php $rk ?>, try this one out if you have not done that. http://roshanbh.com.np Link to comment https://forums.phpfreaks.com/topic/86566-solved-javascript-hider/#findComment-442526 Share on other sites More sharing options...
phpQuestioner Posted January 18, 2008 Share Posted January 18, 2008 i think you've to put the php tag <?php ?> in the variable used i.e. variable should be replaced by <?php $rk ?>, try this one out if you have not done that. http://roshanbh.com.np well that is definitely true; but I figured taith already knew that, so I didn't even mention that. Link to comment https://forums.phpfreaks.com/topic/86566-solved-javascript-hider/#findComment-442549 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.