Wednesday 15 February 2012

javascript - how to set the speed of dropdown menu? -


First of all, I have created a tab content in html using javascript and now, in this drop-down content I move. My problem is, how can I decide to leave the content, can you give me a sample or idea how I can solve this problem. thanks for answer.

This is my sample code:

  & lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" & gt; Function sample () {if (document.getElementById ("cute") style.display == "none") {document.getElementById. ("Cute"). Style.display = ""; .. Document.getElementById ("ugly") style.display = "none"; .. Document.getElementById ("Good") style.display = "none"; }} Function samplez () {if (document.getElementById ("good" style.display == "none") {document.getElementById. ("good"). Style.display = ""; .. Document.getElementById ("cute") style.display = "none"; .. Document.getElementById ("ugly") style.display = "none"; }} Function samplex () {if (document.getElementById ("ugly") style.display == "none") {document.getElementById. ("Unattractive"). Style.display = ""; .. Document.getElementById ("cute") style.display = "none"; .. Document.getElementById ("Good") style.display = "none"; }} & Lt; / Script & gt; & Lt; / Head & gt;   

Here is the body code:

  & lt; Body & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "#" onclick = "return false; sample ();" & Gt; Sample & lt; / A & gt; & Lt; / Li & gt; & Lt; P id = "cute" style = "display: none;" & Gt; This sample 1. & lt; / P & gt; & Lt; Li & gt; & Lt; A href = "#" onclick = "return false; sample x ();" & Gt; Sample x & lt; / A & gt; & Lt; / Li & gt; & Lt; P id = "good" style = "display: none;" & Gt; This sample 2. & lt; / P & gt; & Lt; Li & gt; & Lt; A href = "#" onclick = "return false; sampling ();" & Gt; Sample H & lt; / A & gt; & Lt; / Li & gt; & Lt; P id = "ugly" style = "display: none;" & Gt; This sample 3. & lt; / P & gt; & Lt; / Ul & gt; & Lt; / Body & gt; & Lt; / Html & gt;   

My question is, if you click anything of the link, then set the speed of the drop-down view.

Use set-timeout Here more info:

No comments:

Post a Comment