garyblackpool Posted October 6, 2009 Report Share Posted October 6, 2009 hi i have been trying to write a function to make div visible and hidden so i hve started off just trying to make one work. But i just dont understand where i am going wrong.Thanks for assistanceGary body{background-color:black;}div.intro{font-size:100px;color:white;font-family:areal,helvetica,sans-serif;font-weight:bold;width:50%;position:absolute;left:25%;top:30%;}div#one{visibility:visible;}div#two{visibility:hidden;}div#three{visibility:hidden;}</style><script language="JavaScript" type="text/javascript">function first("one"){var one= document.getElementById("one").style.visiblity="visiable";setTimeout("second()",1000); }function second(){document.getElementById("one").style.visiblity="hidden";}</script></head><body onload="first(); second();"><div class="intro" id="one"> Touch It</div><div class="intro" id="two"> Bring It </div><div class="intro" id="three"> Baby </div> Link to comment Share on other sites More sharing options...
dsonesuk Posted October 6, 2009 Report Share Posted October 6, 2009 (edited) are you tryiing to achieve something like this?<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*/var one, two;function initiate(){one = setTimeout("first()",3000);}function first(){clearTimeout(one);document.getElementById("one").style.visibility="hidden";document.getElementById("two").style.visibility="visible";two = setTimeout("second()",3000);}function second(){clearTimeout(two);document.getElementById("two").style.visibility="hidden";document.getElementById("three").style.visibility="visible";}/*--*//*]]>*/</script> <style type="text/css">body{background-color:black;}div.intro{font-size:100px;color:white;font-family:areal,helvetica,sans-serif;font-weight:bold;width:50%;position:absolute;left:25%;top:30%;}div#one{visibility:visible;}div#two{visibility:hidden;}div#three{visibility:hidden;}</style></head><body onload="initiate();"><div class="intro" id="one"> Touch It</div><div class="intro" id="two"> Bring It </div><div class="intro" id="three"> Baby </div></body></html> Edited October 6, 2009 by dsonesuk Link to comment Share on other sites More sharing options...
garyblackpool Posted October 6, 2009 Author Report Share Posted October 6, 2009 Yes i am, Thank you very much that is brilliant.i jus finding it difficult to write my own functions.Is do you know of where i may find more detailed advice about it.ThnksGary 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