E
Egalkarl
Guest
Es geht um das vielleicht bekannte "find-in-page" script. Es sucht einfach einen beliebigen String und markiert ihn.
Hier ein Auszug:
var win = window;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == "")
return false;
(...)
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.
(...)
Also: Ich möchte das Script in einem Frame einsetzen, genauer: Links soll der "Such- Table" stehen, gesucht werden soll aber im Hauptframe "main". Sicher sind Anpassungen in der Zeile "var win=window;" nötig... Leider habe ich (noch) keinen Plan vom scripten.
Kannst mir jemand helfen?
Hier ein Auszug:
var win = window;
var n = 0;
function findInPage(str) {
var txt, i, found;
if (str == "")
return false;
(...)
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.
(...)
Also: Ich möchte das Script in einem Frame einsetzen, genauer: Links soll der "Such- Table" stehen, gesucht werden soll aber im Hauptframe "main". Sicher sind Anpassungen in der Zeile "var win=window;" nötig... Leider habe ich (noch) keinen Plan vom scripten.
Kannst mir jemand helfen?