I have a html page in which im using a form. In that form i placed a div element within the form. That div element has another div element within that. how to get the innermost div element value in javascript? This is my html code.
Expand|Select|Wrap|Line Numbers
- <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Insert title here</title>
- <script type="text/javascript">
- document.onkeyup = KeyCheck;
- function KeyCheck()
- {
- var obj = document.Form1.div1;
- alert(obj);
- for(var i=0;i<obj.length;i++) {
- alert(obj[i].name);
- }
- }
- </script>
- </head>
- <body>
- <form name="Form1">
- <div id="div1" style="height:500px; width:500px ;top: 250px; left: 250px; position: absolute; z-index: 2; visibility: show; border: #0000cc 1px solid">
- <div id="div2">
- <B>.</B>
- </div>
- </div>
- </form>
- </body>
- </html>