santu Posted September 29, 2012 Share Posted September 29, 2012 (edited) Hello,I have in problem below this script.I can't flexible the height in javascript. Here height is fixed "if(hh==80)".If any solution - I want the flexible height. please help about this script.----------------------------------------------------------------------------------------------------------------------------------------- <html><head><style type="text/css">#coverlogin{width: 320px; height: 0.1em; overflow:hidden; visibility: hidden;}#loginbox{width: 300px; height: auto; border: 1px solid red; background:#f2f2f2; border:1px solid #e6e6e6; position:relative; padding:10px; font-family:verdana; font-size:11px;}.title{color:#333; text-decoration:none; font-weight:bold; font-family:verdana; font-size:12px;}.close{position:absolute; bottom:0px; right:0px; background:#666666; color:#000; padding:3px 10px; font-family:verdana; font-size:11px; text-decoration:none; color:#fff;}</style> <script type="text/javascript">var hh=0;var inter;function ShowBox(){ if(hh==80) { clearInterval(inter); return; } obj = document.getElementById("coverlogin"); obj.style.visibility = 'visible'; hh+=2; obj.style.height = hh + 'px';} //same way as above but reversedfunction HideBox(){ obj = document.getElementById("coverlogin"); if(hh==2) { obj.style.visibility = 'hidden'; obj.style.height = '0.1em'; clearInterval(inter); return; } hh-=2; obj.style.height = hh + 'px';}</script></head> <body> <a href="#" onClick="inter=setInterval('ShowBox()',3);return false;" class="title">Click here to show the box</a> <div id="coverlogin"><div id="loginbox">Now you can see what's inside the box!<a href="#" onClick="inter=setInterval('HideBox()',3);return false;" class="close">Close It</a></p></div></div> </body></html> ----------------------------------------------------------------------------------------------------------------------------------------- thanks index.html Edited September 29, 2012 by santu Link to comment Share on other sites More sharing options...
Ingolme Posted September 29, 2012 Share Posted September 29, 2012 I'm not sure what "80" is supposed to represent. You can substitute 80 for a dynamic value, like the offsetHeight of another element. Perhaps you want the scrollHeight of the current element. Perhaps this meets your requirements: if(hh == document.getElementById("coverlogin").scrollHeight) The best way to get the right answer from us is to ask the right questions. If not, I can only make guesses. Link to comment Share on other sites More sharing options...
santu Posted October 3, 2012 Author Share Posted October 3, 2012 sorry sir,it;s not running.. please help me another.... Link to comment Share on other sites More sharing options...
Ingolme Posted October 3, 2012 Share Posted October 3, 2012 I don't have enough information. Like I mentioned before I'm just trying to make guesses as to what your problem is. You need to make an accurate english description of what you want done. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now