I have been trying to merge two command scripts, and have gotten nothing. I am trying to use javascript commands to open a new window on Firefox, and on that opened window simulate a Tab key press.
This is the full script that I have come up with so far to open two windows, with the websites being yahoo.com and google.com. ***To fully help me please copy this script, paste to Notepad, save as a .html file and run it on Firefox. You will notice a “Open Windows” button will appear. When you click on it the windows will open:
<html>
<head>
<script type=”text/javascript”>
function open_win() {
window.open(“
window.open(“
}
</script>
</head>
<body>
<form>
<input type=button value=”Open Windows” onclick=”open_win()”>
</form>
</body>
</html>
Now this is what I have come up to simulate a Tab key event when you press the ENTER key:
<script language=”javascript>
function fakeTab() {
if (window.event.keyCode == 13 && window.event.srcElement.tagName == “INPUT”)
window.event.keyCode = 9;
}
documet.onkeydown = fakeTab;
</script>
What I want to do is merge these two scripts, so that when I press that “Open Windows” button, the new window opens and the Tab key press is immediately simulated to move to the next field on the webpage.
I understand that JavaScript is event driven, meaning some event has to occur before you can make things happen. The user must push a key or click somewhere on the page before you can relaly do anything with an event. I want to have the clicking of the “Open Windows” button, that first triggering event which opens a window and simulates the tab key press on that window.