JavaScript Forum JS Made Easy: Free JavaScripts Tutorials Example Code
About This Product
FontsMadeEasy.com
 
The Business Internet
Find it on This page:
 
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet

     
Jsmadeeasy Forums Home   Search   Login   Register   Member List  
JS Made Easy  > JavaScript programming  > Re:  
 
Display using:  
Previous Thread :: Next Thread 
 Author Thread: Searching for text within a source code
Aloysius is not online. Last active: 7/28/2004 3:52:08 PM Aloysius
Joined: 28 Jul 2004
Total Posts: 1
 
Searching for text within a source code
Posted: 14 Nov 2002 11:38 AM
HI!

I'm quite new to Javascript, and got this question:

Is it possible to use Javascript to load a page, and consistently refresh the page (so that I don't need to press F5) and to highlight any words (or sound an alert) that I'm looking out for exists on the page?
e.g. if I want the alert to be executed when I've got new mail, and the text I'm searching for is "new mail", when the page is loaded, can Javascript search through the source code of the page for the words "new mail" and sound an alert when such a phrase is found.

Also, I'm wondering how to do frames, so that I can load say 2 different pages on the same html file.

Thanks.
qsaaiman is not online. Last active: 5/30/2006 4:23:08 AM qsaaiman
Top 25 Poster
Joined: 28 Jul 2004
Total Posts: 21
 
Re:
Posted: 22 Nov 2002 06:03 AM
Hey.
Refreshing the page is easy:
<meta http-equiv="REFRESH" content="21">

The word detections a bit more tricky. the best i can suggest is this:
create a text box (i'll use your example) called "mail_chk":
<input type="text" name="mail_chk" value="(here you insert the source of the data you get)">

Java should look something like this (MUST be at the bottom of the page):
<script language="JavaScript">
if (formname.mail_chk.value == "New Mail") {
alert("You have new mail!")
}
</script>
only if you are using frames

As for frames. here is an example:
(above your <body> tag)
<frameset rows="19%,*">
<frame name="" src="" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
<frameset cols="12%,*">
<frame name="" src="" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
<frame name="" src="" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
</frameset>
</frameset>

Quintin Saaiman

Quintin Saaiman
Previous Thread :: Next Thread 
Goto to page:  Prev Next
 
Jsmadeeasy.com  > JS Made Easy  > JavaScript programming  > Re: