Re: how to trigger a .js from script?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: how to trigger a .js from script?

From: Dr Clue <ianstormsfw@mindspring.com>
Date: Wed Sep 21 2005 - 23:18:46 CEST

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/Scripts/Member.asp?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("IFviewpages")
self.aLinks=self.oIFviewpages.contentWindow.document.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
--.
Received on Tue Oct 18 03:27:14 2005