| Index | Code Tester |
Window Object
window.open("url", "name", "parameters")
winX = window.open("myfile.htm", "myfile", "width = 300, height = 200, left = 50, top = 100, toolbar = no")
window.close()
winX.close()
Writing to a New Window
Example: using the following statement:winX = window.open("myfile.htm", "myfile", "width = 300, height = 200, left = 50, top = 100, toolbar = no")winX.document.write("Text written...")
window.event
<body onclick = "alert(window.event.clientX); alert(window.event.shiftLeft)">
1. List 5 window.event properties and what they do.
2. Create a page with 5 buttons. When the user clicks each button a window should open. Make sure that each window has different features.
3. Add a button to the window that is opened in #2 that permits the user to close the window.
4. Add a button to your main page that closes all 5 windows.
5. Create a page that enables the user to determine the distance between any two points on the page. The user should be able to determine the distance between two points by holding the mouse down on one point, moving the mouse to a second point, and then releasing the mouse. The distance should be displayed in an alert. You should add a div with known dimensions so that the user can verify the results. The distance between two points is determined using: r = sqrt((dx*dx) + (dy*dy)) where dx = x2 - x1 and dy = y2 - y1.
6. Create a page that sets the size of the font to the x location of the mouse as the user moves the mouse.