jagasker
11-05-2006, 10:52 PM
Hi,
I am trying to write a javascript on Windows XP for my website that is supposed to perform a text search on an external page and return a result which, based on the result, will play a certain audio file. The script that I am writing is not working, I keep on getting redirected to the external page in which I am trying to perform the search, and I am getting numerous javascript errors, such as 'member not found', 'body is null or not an object', 'expected ]', and 'expected ;'. I have been trying to get this script to work all weekend, and it is getting frustrating. Any help to get this script functional would be greatly appriecated. 3 versions of the script are attached below.
jagasker
-------------------------------
Script Version 1
-------------------------------
var adv1=[document="http://www.weather.gov/alerts/pa.html"].body.createTextRange()
var query1a=adv1.findText('Carbon')
var query1b=adv1.findText('Tornado Warning')
if (query1a == true & query1b == true)
document.write('Tornado Warning in effect')
else
document.write('No Alerts')
--------------------------------
Script Version 2
--------------------------------
var adv1=[window.location="http://www.weather.gov/alerts/pa.html"].body.createTextRange()
var query1a=adv1.findText('Carbon')
var query1b=adv1.findText('Tornado Warning')
if (query1a == true & query1b == true)
document.write('Tornado Warning in effect')
else
document.write('No Alerts')
---------------------------------
Script Version 3
---------------------------------
var doc="http://www.weather.gov/alerts/pa.html"
var adv=doc.body.createTextRange()
var query1a=adv1.findText('Carbon')
var query1b=adv1.findText('Tornado Warning')
if (query1a == true & query1b == true)
document.write('Tornado Warning in effect')
else
document.write('No Alerts')
I am trying to write a javascript on Windows XP for my website that is supposed to perform a text search on an external page and return a result which, based on the result, will play a certain audio file. The script that I am writing is not working, I keep on getting redirected to the external page in which I am trying to perform the search, and I am getting numerous javascript errors, such as 'member not found', 'body is null or not an object', 'expected ]', and 'expected ;'. I have been trying to get this script to work all weekend, and it is getting frustrating. Any help to get this script functional would be greatly appriecated. 3 versions of the script are attached below.
jagasker
-------------------------------
Script Version 1
-------------------------------
var adv1=[document="http://www.weather.gov/alerts/pa.html"].body.createTextRange()
var query1a=adv1.findText('Carbon')
var query1b=adv1.findText('Tornado Warning')
if (query1a == true & query1b == true)
document.write('Tornado Warning in effect')
else
document.write('No Alerts')
--------------------------------
Script Version 2
--------------------------------
var adv1=[window.location="http://www.weather.gov/alerts/pa.html"].body.createTextRange()
var query1a=adv1.findText('Carbon')
var query1b=adv1.findText('Tornado Warning')
if (query1a == true & query1b == true)
document.write('Tornado Warning in effect')
else
document.write('No Alerts')
---------------------------------
Script Version 3
---------------------------------
var doc="http://www.weather.gov/alerts/pa.html"
var adv=doc.body.createTextRange()
var query1a=adv1.findText('Carbon')
var query1b=adv1.findText('Tornado Warning')
if (query1a == true & query1b == true)
document.write('Tornado Warning in effect')
else
document.write('No Alerts')