Jump to content

[SOLVED] javascript hider


taith

Recommended Posts

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.