It can't be done. You can't automate site navigation in JavaScript if you don't own the site, at least not what you want to do. You need desktop macro/automation software. I recommend AutoIt, it's free and about the best option around.
Make sure what you're doing is legal and moral. If you're trying to, say, automate something like eBay bidding, then you're an idiot and don't deserve anyone's help.
2007-03-19 03:43:12
·
answer #1
·
answered by oracle128au 7
·
1⤊
1⤋
Eric,
First off, unless both the javascript frame and the login frame are in the same domain, you cannot do this (the browser's security will stop you). If this is a problem, then you can run the browser as a COM component from a script running on your machine (if it is windows). There is some stuff on this sort of work at http://www.nerds-central.com .
OK, let us assume that the javascript and login are on the same domain, then you need to get a reference to the window object of the login frame. If you have your frames names - then this is easy:
var loginInFrameWindow=top.loginFrame;
Where you called the frame loginFrame.
Next you want to get to the Document Object Model of the login frame, to do that you get the document object:
var doc=loginFrameWindow.document.
Now - if the inputs you want to fill in have ID attributes - life is sweet as you can put something like
doc.getElementById('nameInput').value='myUsername';
Otherwise you might have to 'walk the DOM', again, there is some stuff on this on my website.
Finally, if there is only one form in the login window, then
doc.forms[0].submit();
You are asking a BIG question, so I am just giving you some pointers here! Again - feel free to browse http://www.nerds-central.com .
Cheers
AJ
2007-03-19 03:13:29
·
answer #2
·
answered by Alex Turner 2
·
1⤊
0⤋
If what you are looking to get is a data dump or the like, it makes much more sense to write some PHP to get what you are after and run it directly off your Web server as a cron job.
However, as previously stated, you may not have access to the server itself or it may not be your server. In which case, you could use PHP, CURL and cron to interact with the form and accomplish what you want.
I know you probably feel you'll accomplish what you are after with JavaScript but I doubt it.
However, to answer your specific question, you can call the form page's elements by name. You simply name the right window and refer to elements in that window by name.
For example, a textbox could be seen this way (remove spaces before periods):
var textbox= top. frames['windowname']. form['formname']. fieldid. value;
2007-03-19 05:06:24
·
answer #3
·
answered by Anonymous
·
1⤊
0⤋
We can access the contents of one frame from in another frame. But I can give you a better idea, after seeing your html page. Can you send me your page. Or post its html here.
2007-03-20 21:56:08
·
answer #4
·
answered by Atif Majid 3
·
0⤊
0⤋
have been I on your shoes, i might use a floating physique (iFrame). Use your known web site with the counter, yet use an iframe to exhibit the type and supply consumer navigation for the period of the attempt questions.
2016-10-02 09:21:01
·
answer #5
·
answered by thao 4
·
0⤊
0⤋
I have no idea what you are asking, but this is an awesome website that has tutorials and stuff in it. It's how I learned javascript.
http://www.w3schools.com/js/default.asp
2007-03-19 03:04:23
·
answer #6
·
answered by hello 6
·
0⤊
1⤋