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> Quote Link to comment 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... Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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.