Java Reference
In-Depth Information
var inputTop = document.getElementById(“inputTop”);
divBox.style.left = parseInt(inputLeft.value) + “px”;
divBox.style.top = parseInt(inputTop.value) + “px”;
}
</script>
</head>
<body>
<div id=”divBox”>
<form id=”formBoxController” onsubmit=”moveBox(); return false;”
action=”“>
<p>
Left:
<input type=”text” id=”inputLeft” />
</p>
<p>
Top:
<input type=”text” id=”inputTop” />
</p>
<p>
<input type=”submit” value=”Move The Box” />
</p>
</form>
</div>
</body>
</html>
Save this fi le as ch12_examp6.htm . When you load the page into your browser, you should see a silver
box in the upper-left corner of the screen. Inside this box, you'll see a form with two fi elds and a button,
as shown in Figure 12-13.
Figure 12-13
Search WWH ::




Custom Search