By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,636 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,636 IT Pros & Developers. It's quick & easy.

how to trigger a .js from script?

P: n/a
I use a web page that brings up a table with a series of links that look
like this...

<a href="javascript:GetAgent('MA142')">

these links open pages that look like this...
http://info.webpage.com/Roster/Scrip...sp?PubID=MA142

I'd like to use a script to sequentially trigger each link to open the pages
one at a time so I can get the info from the pages that open with the links.

Can someone help by showing some example code as to how to either trigger
the GetAgent script or to send the full URL... I'm a pretty lousy scripter.

I appreciate the help!
Sep 21 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
livin wrote:
I use a web page that brings up a table with a series of links that look
like this...

<a href="javascript:GetAgent('MA142')">

these links open pages that look like this...
http://info.webpage.com/Roster/Scrip...sp?PubID=MA142

I'd like to use a script to sequentially trigger each link to open the pages
one at a time so I can get the info from the pages that open with the links.

Can someone help by showing some example code as to how to either trigger
the GetAgent script or to send the full URL... I'm a pretty lousy scripter.

I appreciate the help!


If the pages you are manipulating are *not* on your own site, then
you will need to do some extra work to bypass the cross-domian
security features, but none the less , the notes below might help

Use an <iframe name="IFviewpages" onload="doSomething()"
src="blank.html"></iframe>

Each time a page loads in the iframe, your function would get called.

in that function you can obtain the links
self.oIFviewpages=self.document.getElementById("IF viewpages")
self.aLinks=self.oIFviewpages.contentWindow.docume nt.getElementsByTagName("A")

you can iterate through these and run them into a second iframe
setup like the first with it's own onload funtion to parse the page ,
then trigger the next link in the array

There is also XMLHTTP , which could be more usefull in retrieveing
the page contents.


--
--.
--=<> Dr. Clue (A.K.A. Ian A. Storms) <>=-- C++,HTML, CSS,Javascript
--=<> http://resume.drclue.net <>=-- AJAX, SOAP, XML, HTTP
--=<> http://www.drclue.net <>=-- SERVLETS,TCP/IP, SQL
--.
Sep 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.