Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple script to automatically restart modem and close tab/page...

Status
Not open for further replies.

BliND123

Technical User
Feb 26, 2008
2
I'm new to javascript and am currently trying something simple to automatically restart my DSL modem. I figured out how to have my script input the access code automatically with:


var PASSWORD = "************";
document.getElementById("pw0").value = PASSWORD;


So this worked, now I am trying to figure out how to get it to automatically click continue. I was looking at the this:

<INPUT type=submit class=LINKBUTTON name="Continue" value=" Continue " style="width:135">&nbsp;&nbsp;<INPUT type=submit class=LINKBUTTON name="cancel" value=" Cancel " style="width:135">

In the source and I was thinking one of these would work:

document.getElementById("Continue").submit();
document.getElementById("Continue").click();

document.getElementById(" Continue ").submit();
document.getElementById(" Continue ").click();

But they don't want to do anything, it just stays on the page.
 
Hi,

As soon as you have a <INPUT type="submit"> tag, then, you've got an enclosing <FORM></FORM> tag the button is in charge to submit.
Try rather something like :
Code:
document.getElementById("formId").submit();
Where "formId" is the "id" attribute of the form enclosing the button.



Water is not bad as long as it remains outside human body ;-)
 
Thats how I figured out pw0 was where I needed it to input my access code from here:

TABLE cellSpacing=0 cellPadding=0 border=0><TR><TD>Modem Access Code:&nbsp;</TD><TD><INPUT type=text name=pw0 VALUE=""></TD></TR><TR><TD COLSPAN=2>&nbsp;</TD></TR><TR><TD>&nbsp;</TD><TD ALIGN="center"><INPUT type=submit class=LINKBUTTON name="Continue" value=" Continue ">&nbsp;&nbsp;<INPUT type=submit class=LINKBUTTON name="cancel" value=" Cancel "></TD></TR></TABLE>

And by looking at that above for pw0, I thought "Continue" (with the parenthesis) would be what I would need for it to continue by itself but it doesn't do anything.

And just so you know, I am making this script to run anytime I open in FireFox from the GreaseMonkey extension.
 
Like Targol said, you have to submit a FORM, which you don't have on your page. Forms have submit methods, buttons don't. Submit buttons actuate submit methods of the form that contains them, but you have no form. No form - no submit() method.

Lee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top