I have 5 divs in my HTML page and 5 buttons. I have to do auto scrolling from the 5th Diva when the button is clicked 5. But I do not want to use the position to scroll in the X axis ... I want to move in context with div id. So how can I do this? Help me in jquery or javascript
Please take a look at the following link
I have pasted the code on it.
Enter code Enter code here & lt ;! DOCTYPE html public "- // W3C // DTD HTML 4.01 transitional / / n" "http://www.w3.org/TR/html4/loose.dtd"> & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta http-equiv = "content-type" content = "text / html; charset = ISO-885 9-1" & gt; & Lt; Title & gt; Insert title here & lt; / Title & gt; & Lt; Script type = "text / javascript" & gt; Function Scroll (Val) {//alert(document.getElementById (Oval)); Document.getElementById (Val). Click ()} & lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "div1" style = "height: 200px" & gt; The content of your div1 is here & lt; / Div & gt; & Lt; Div id = "div2" style = "height: 200px" & gt; The content of your div2 is here & lt; / Div & gt; & Lt; Div id = "div3" style = "height: 200px" & gt; The content of your div3 is here & lt; / Div & gt; & Lt; Div id = "div4" style = "height: 200px" & gt; The content of your div4 is here & lt; / Div & gt; & Lt; Div id = "div5" style = "height: 200px" & gt; The content of your div5 is here & lt; / Div & gt; & Lt; Div style = "display: none;" & Gt; & Lt; A href = "# div1" id = "id1" & gt; Link text here & lt; / A & gt; & Lt; A href = "# div2" id = "id2" & gt; Link text here & lt; / A & gt; & Lt; A href = "# div3" id = "id3" & gt; Link text here & lt; / A & gt; & Lt; A href = "# div4" id = "id4" & gt; Link text here & lt; / A & gt; & Lt; A href = "# div5" id = "id5" & gt; Link text here & lt; / A & gt; & Lt; / Div & gt; & Lt; Input type = "button" onclick = "scroll ('id1')" value = "button 1" & gt; & Lt; / Input & gt; & Lt; Input type = "button" onclick = "scroll ('id2')" value = "button2" & gt; & Lt; / Input & gt; & Lt; Input type = "button" onclick = "scroll ('id3')" value = "button3" & gt; & Lt; / Input & gt; & Lt; Input type = "scroll" onclic = "('id4')" value = "button4" & gt; & Lt; / Input & gt; & Lt; Input type = "button" onclick = "scroll ('id5')" value = "button 5" & gt; & Lt; / Input & gt; & Lt; / Body & gt; & Lt; / Html & gt; Enter code here
Comments
Post a Comment