It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Small problem

Small problem

Postby p4plus2 on Sat Feb 23, 2008 11:39 pm

EDIT fixed problem working code is this for anybody who wants it:
Code: Select all
<style language="text/css">
.box{
display : none;
}
</style>

function doExpandCollapse(id,img){
   var b = document.getElementById(id);
      if (b.style.display=='none'){
         b.style.display='inline';
      }
      else{
         b.style.display='none';
      }
   return false;
}





OLD POST:



Heres my problem, the code I have been working on bellow is meant to expand and collapse text\forms\whatever....on load I want it to be collapsed however it is always expanded no matter what I seem to do.
So how can I get it to load collapsed?
Thanks in advanced!
~p4plus2~


Code: Select all
<html>
<head>
<script>
function doExpandCollapse(id,img){
   var b = document.getElementById(id);
      if (b.style.display=='none'){
         b.style.display='';
      }
      else{
         b.style.display='none';
      }
   return false;
}
</script>
</head>
<body>
<form>
<div style="border:0px;">
<a href="#" onclick="return doExpandCollapse('box','btn1')">expand/collapse</a>
<div id="box">
blah<br>blah<br>blah<br>blah<br>blah<br>blah<br>
</div>
</div>
</form>
</body>
</html>
p4plus2
 
Posts: 3
Joined: Sat Feb 23, 2008 11:32 pm

Who is online

Users browsing this forum: No registered users and 9 guests