HomeJavaScript Page 3 - Understanding The JavaScript Event Model (part 2)
How's The Weather Up There? - JavaScript
In this concluding article on the JavaScript event model, findout how the Event object can be used to do ever more complex things,including manipulating the dimensions of a Web page and tracking andintercepting keyboard and mouse events.
<html>
<head>
<script language="JavaScript">
function changeWidth()
{
document.width=40
}
</script>
</head>
<body>
<form>
<input type="button" value="Click Me" onClick="changeWidth()"> </form>
This is a really, really, really, really, really, really, really,
really, really, really, really, really, really, really, really, really,
really, really, really long string.
</body>
</html>
Now, when you click the button, you'll see that the document width reduces to 40 pixels, and the incredibly long sentence gets cropped to exactly that width.
Before you get all excited, though, you should know that the "width" and "height" properties only work in Netscape Navigator 4.x.