| <html> |
| <head> |
| <script type="text/javascript"> |
| function test() { |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| |
| window.scrollTo(0, 1000); |
| |
| var clickEvent = document.createEvent("HTMLEvents"); |
| clickEvent.initEvent("click", "true", "true"); |
| |
| var gotoTop = document.getElementById("gotoTop"); |
| gotoTop.dispatchEvent(clickEvent); |
| |
| document.write("<div>document.body.scrollTop: " + document.body.scrollTop +"</div>"); |
| } |
| } |
| </script> |
| </head> |
| <body onload="test()"> |
| When clicking the link "Goto Top" at the middle of the page, it should go here. |
| <div style="height:1500px; width:500px; background:#ffddff"></div> |
| <a id="gotoTop" name="gotoTop" href="#">Goto Top</a> |
| <div style="height:3000px; width:500px; background:#ffffdd"></div> |
| <a name="youshouldnotfindme">Oops! Here is the bottom of the page.</a> |
| <a id="" name="youshouldnotfindmeeither">Oops!</a> |
| <a name="">Oops!</a> |
| </body> |
| </html> |