473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

searches and conditional results

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
-------------------------------
Expand|Select|Wrap|Line Numbers
  1. var adv1=[document="http://www.weather.gov/alerts/pa.html"].body.createTextRange()
  2. var query1a=adv1.findText('Carbon')
  3. var query1b=adv1.findText('Tornado Warning')
  4.  
  5. if (query1a == true & query1b == true)
  6. document.write('Tornado Warning in effect')
  7. else
  8. document.write('No Alerts')
  9.  
--------------------------------
Script Version 2
--------------------------------
Expand|Select|Wrap|Line Numbers
  1. var adv1=[window.location="http://www.weather.gov/alerts/pa.html"].body.createTextRange()
  2. var query1a=adv1.findText('Carbon')
  3. var query1b=adv1.findText('Tornado Warning')
  4.  
  5. if (query1a == true & query1b == true)
  6. document.write('Tornado Warning in effect')
  7. else
  8. document.write('No Alerts')
  9.  
---------------------------------
Script Version 3
---------------------------------
Expand|Select|Wrap|Line Numbers
  1. var doc="http://www.weather.gov/alerts/pa.html"
  2. var adv=doc.body.createTextRange()
  3. var query1a=adv1.findText('Carbon')
  4. var query1b=adv1.findText('Tornado Warning')
  5.  
  6. if (query1a == true & query1b == true)
  7. document.write('Tornado Warning in effect')
  8. else
  9. document.write('No Alerts')
  10.  
Nov 5 '06 #1
1 1128
acoder
16,027 Expert Mod 8TB
All of the script versions have the wrong syntax. You need to load the page in a window, frame or iframe and then try to access it. However, since it's not from your domain, the browser will give a permission/access denied error. To work around that, load the site from your domain using some server-side code, or just code this on the server-side.
May 27 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
8
by: neblackcat | last post by:
Would anyone like to comment on the following idea? I was just going to offer it as a new PEP until it was suggested that I post it here for comment & consideration against PEP 308. I'm far...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
0
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics,...
8
by: DQ dont quit | last post by:
I'm currently working on a ASP.Net / C# / SQL 2000 project that involves the entering of keywords, that a web user enters, and then searching MSWord documents for those words. This information...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.