Edit detail for Javascript revision 1 of 1

1
Editor: brian
Time: 2004/12/12 05:20:26 GMT+0
Note:

changed:
-
This is a javascript funciton to run from Safari

<pre>
set dsiplaylink to "
thelinks = document.getElementsByTagName(\"a\")
newwin = window.open(\"\")
newwin.document.open()
for (i=0; i< thelinks.length; i++) 
  newwin.document.write(\"<p>\" + thelinks[i].href + \" <br>\" + thelinks[i].innerHTML + \"</p>\")
  
"
set returnlinks to "
var thelinks = document.getElementsByTagName(\"a\")
var linktext = \"\"
for (i=0; i< thelinks.length; i++) 
  linktext = linktext + thelinks[i].href + \"\\t\" +  thelinks[i].innerHTML + \"\\n\"
return linktext
"

tell application "Safari"
	do JavaScript returnlinks in document 1
end tell

</pre>

This is a javascript funciton to run from Safari

set dsiplaylink to "
thelinks = document.getElementsByTagName(\"a\")
newwin = window.open(\"\")
newwin.document.open()
for (i=0; i< thelinks.length; i++) 
  newwin.document.write(\"

\" + thelinks[i].href + \"
\" + thelinks[i].innerHTML + \"

\")

" set returnlinks to " var thelinks = document.getElementsByTagName(\"a\") var linktext = \"\" for (i=0; i< thelinks.length; i++) linktext = linktext + thelinks[i].href + \"\\t\" + thelinks[i].innerHTML + \"\\n\" return linktext "

tell application "Safari" do JavaScript returnlinks in document 1 end tell