|
-
Jun 29th, 2005, 03:27 PM
#1
Thread Starter
Fanatic Member
Last edited by Ruku; Jun 29th, 2005 at 10:42 PM.
-
Jun 29th, 2005, 08:47 PM
#2
Fanatic Member
Re: Scroll down to ?word? [HTML/PHP]
try this:
HTML Code:
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 15</title>
</head>
<body>
<a href="#test">test</a><br>
<a href="#hello">hello</a><br>
<a href="#goodbye">goodbye</a><br>
<a href="#google">google</a><br>
<a href="#yahoo">yahoo</a><br>
<a href="#computer">computer</a><br>
<a href="#people">people</a><br>
<a href="#coke">coke</a><br>
<a href="#smoke">smoke</a><br>
<a href="#slap">slap</a><br>
<a href="#crack">crack</a><br>
<a href="#argh">argh</a><br>
<a href="#sniff">sniff</a><br>
<a href="#stuff">stuff</a><br>
<a href="#ruff">ruff</a><br>
<a href="#cup">cup</a><br>
<a href="#duff">duff</a><br>
<a href="#dup">dup</a><br>
<a href="#dump">dump</a><br>
<a href="#argh">argh</a><br>
<p><a name="test" href="#test">test</a></p>
<a name="hello"><p>hello</p></a>
<a name="goodbye"><p>goodbye</p></a>
<a name="google"><p>google</p></a>
<a name="yahoo"><p>yahoo</p></a>
<a name="computer"><p>computer</p></a>
<a name="people"><p>people</p></a>
<a name="coke"><p>coke</p></a>
<a name="smoke"><p>smoke</p></a>
<a name="slap"><p>slap</p></a>
<a name="crack"><p>crack</p></a>
<a name="argh"><p>argh</p></a>
<a name="sniff"><p>sniff</p></a>
<a name="stuff"><p>stuff</p></a>
<a name="ruff"><p>ruff</p></a>
<a name="cup"><p>cup</p></a>
<a name="duff"><p>duff</p></a>
<a name="dup"><p>dup</p></a>
<a name="dump"><p>dump</p></a>
<a name="argh"><p>argh</p></a>
</body>
</html>
you could also use a simple javascript:
HTML Code:
<head>
<script language="JavaScript">
<!-- Original by [url]http://javascript.internet.com[/url] More javascripts [url]http://www.hypergurl.com[/url] -->
var NS4 = (document.layers); // Which browser?
var IE4 = (document.all);
var win = window; // window to search.
var n = 0;
function findInPage(str)
{
var txt, i, found; if (str == "") return false; // Find next occurance of the given string on the page, wrap around to the // start of the page if necessary.
if (NS4) // Look for match starting at the current point. If not found, rewind
{
// back to the first match.
if (!win.find(str)) while(win.find(str, false, true)) n++; else n++; // If not found in either direction, give message.
if (n == 0) alert("Not found.");
}
if (IE4)
{
txt = win.document.body.createTextRange();
// Find the nth match from the top of the page.
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++)
{
txt.moveStart("character", 1); txt.moveEnd("textedit"); } // If found, mark it and scroll it into view.
if (found)
{
txt.moveStart("character", -1); txt.findText(str);
txt.select(); txt.scrollIntoView(); n++;// Otherwise, start over at the top of the page and find first match.
}else{
if (n > 0)
{
n = 0; findInPage(str);// Not found anywhere, give message.
}else{
alert("Not found.");
}
}
return false;
}
}
</script>
</head>
<body>
<form name="search" onSubmit="return findInPage(this.string.value);">
<div align="center"> <p><font size=3> <input name="string" type="text" size=15 onChange="n = 0;">
</font>
<input type="submit" value="Search Page">
</p>
</div>
</form>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
hello
</body>
Last edited by ALL; Jun 29th, 2005 at 08:58 PM.
-
Jun 29th, 2005, 10:42 PM
#3
Thread Starter
Fanatic Member
Re: Scroll down to ?word? [HTML/PHP]
thx!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|