View Full Version : Clicking a button with Javascript

08-27-2011, 11:50 PM
For school I'm supposed to write a JS code which visits a website, and then clicks on a button on that website. I used the document.location method to visit the web page, but then if I use the document.forms[0].elements[0].click() function to click a button, nothing happens. The click() function has always worked for me when the JS code is embedded in the web page, but its not in this case because the code has to click a button on an external website. So how can I do this? I just need me Javscript program to visit a site, and then click a button on that site. Please help, thanks.

Old Pedant
08-28-2011, 06:56 AM
Can't be done with normal browser coding with arbitrary pages.

The two web pages *MUST* come from the *SAME DOMAIN* or JavaScript is not allowed to "see" the content of the other page.