geht mit einem kleinen Trick. Den folgenden Text (alles 1 Zeile)
Code:
java script:var gHCount,gHText,gHKeywords,gHRE;var gHColors=new Array("#ffff66","#A0FFFF","#99ff99","#ff9999","#ff66ff","burlywood","aquamarine","coral","cornflowerblue","cadetblue","chartreuse","chocolate","darkgoldenrod","darkgray","darkkhaki","yellow","lightpink","greenyellow","aqua","darkorange","darksalmon","darkseagreen","darkturquoise","deeppink","deepskyblue","dodgerblue","fuchsia","gold","goldenrod","indianred","khaki","lawngreen","lightblue","lightcoral","lightgreen","lightgrey","pink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lime","limegreen","magenta","mediumaquamarine","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","mistyrose","navajowhite","olive","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","peachpuff","peru","hotpink","plum","powderblue","red","rosybrown","royalblue","salmon","sandybrown","silver","skyblue","springgreen","tan","thistle","tomato","turquoise","violet","wheat","yellowgreen");function getCookie() {var search = "AgoHighlight=";gHText='';if (document.cookie.length > 0) {offset = document.cookie.indexOf(search); if (offset != -1) {offset += search.length;end = document.cookie.indexOf(";", offset); if (end == -1)end = document.cookie.length;gHText=unescape(document.cookie.substring(offset, end));}}}function setCookie() {document.cookie = "AgoHighlight=" + escape(gHText)+ ";path=/;";}function CheckSearchString(text){var x=text;if(text==null)return;if(text.length==0)return;text="|" + text.replace(/\W+/g,"|") + "|";text=text.replace(/\|+/g,"|");if(!text.length> 1)return;gHKeywords=null;gHRE=null;gHText=x;gHCoun
t=null;setCookie();text=text.substring(1,text.length-1).toLowerCase();gHCount=text.split("|");gHKeywords=text.split("|");for (var i=gHCount.length-1;i>=0;i-- ){gHKeywords[gHKeywords[i]]=i;gHCount[gHCount[i]]=
0;}gHRE=new RegExp("((" + gHKeywords.join(")|(") + "))", "i");return true;}function ClearWindowHighlights(w){var result=false;try{if (w.frames.length>0){for (var i=0;i<w.frames.length;i++){result= ClearWindowHighlights(w.frames[i]) || result;}}else{result= ClearNodeHighlights(w.document.body);}}catch(er){alert(er);return result;}return result;}function ShowWindowHighlights(w){try{if (w.frames.length>0){for (var i=0;i<w.frames.length;i++){ShowWindowHighlights(w.frames[i]);}}else{ShowNodeHighlights(w.document.body, w.document);}}catch(er){alert(er);return true;}return true;}function ClearNodeHighlights(node){var child, result=false;if (node==null)return result;if (node.nodeType==1){if (node.AgoHighlight){result=true;node.parentNode.replaceChild(node.firstChild,node);}else if( node.childNodes && node.tagName.toUpperCase()!="SCRIPT" && node.tagName.toUpperCase!="STYLE"){for (child=0; child < node.childNodes.length; child++){result= ClearNodeHighlights(node.childNodes[child]) || result;}}}return result;}function ShowNodeHighlights(node,doc){var nkeyw,match, pos=0, skip=0, spannode, middlebit, endbit, middleclone;if (node==null)return skip;if(node.nodeType==3 && node.data){pos=node.data.search(gHRE);if(pos>=0){skip=1;match=RegExp.$1. toLowerCase();nkeyw=gHKeywords[match];gHCount[matc
h]++;spannode=doc.createElement("SPAN");spannode.AgoHighlight=true;spannode.style.fontWeight="bold";spannode.style.color="black";spannode.style.backgroundColor=gHColors[nkeyw];middlebit=node.splitText(pos);endbit=middlebit.splitText(match.length);middleclone=middlebit.cloneNode(true);spannode.appendChild(middleclone);middlebit.parentNode.replaceChild(spannode,middlebit);}}else if(node.nodeType==1 && node.childNodes && node.tagName.toUpperCase()!="SCRIPT" && node.tagName.toUpperCase!="STYLE"){for (var child=0; child < node.childNodes.length; ++child){child=child+ShowNodeHighlights(node.childNodes[child],doc);}}return skip;}function ShowMsg(showmsg){var text="", text2="",j=0;if(!showmsg)return;for (var i=0;i<gHCount. length;i++){j+=gHCount[gHCount[i]];text+=gHCount[i
] + ": " + gHCount[gHCount[i]]+"\n";text2+="<BR><B style='color:black;background-color:" + gHColors[i] +"'>"+ gHCount[i] + "</B>: " + gHCount[gHCount[i]];}text="Items found:\n\n" + text + "\nTotal: " +j+" matches.\n ";text2="<P>Items found: <BR>"+text2+"<BR><BR>Total: " + j + " matches.</P>";switch(showmsg){case 1:if(j==0)alert("No items found for search string:\n'"+gHText+"'");break;case 2:alert(text);break;case 3:var w=window.open("","Highlight Results", "menubar=no, resizable=no,location=no,status=no,toolbar=no,scro
llbar=yes,width=160,height="+ (120+ gHCount.length*20));w.document.write(text2);break;}return;}function Highlight(showmsg){var text;try{if (ClearWindowHighlights(window)) return;if (gHText==null)getCookie();text=prompt("Highlight keywords:", gHText); if(!CheckSearchString(text))return;ShowWindowHighl
ights(window);if (showmsg)ShowMsg(showmsg);}catch(er){alert(er);ret
urn;}} Highlight();