Modificering af script
Jeg bruger en lille applet søger. Søgeresultaterne bliver præsenteret som links til pågældende sider med følgende script/resultatside. Det jeg skal bruge er muligheden for at kunne definere hvilken frame linksene skal åbne i<script language=\"JavaScript\">
<!--
//Text used in search results messages:
var noData_txt = \"No search data were provided\";
var yourSearch_txt = \"Your search for\";
var exactMatches_txt = \"with exact matches only\";
var excludingHTML_txt = \"excluding HTML\";
var yielded_txt = \"yielded\";
var closestAnchor_txt = \"Closest anchor\";
var docInfo_txt = \"Document Info\";
var context_txt = \"Match Context\";
var noMatches_txt = \"No matches\";
//Which elements should be displayed along with the results?
var displayAnchor = true;
var displayDocInfo = false;
var displayContext = false;
//If you do not want to display the context (you set displayContext to false),
//you should also set the applet parameters leadingcontextlength and
//trailingcontextlength to zero to conserve memory.
function writeResults() {
var estr=this.location.toString();
var index=estr.indexOf(\"?\");
if (index == -1) {
document.writeln(\"<em>\" + noData_txt + \"</em>\");
return;
}
index++;
estr=estr.substring(index,estr.length);
index=estr.indexOf(\",\");
document.writeln(\"<dl>\");
document.write(\"<dt>\" + yourSearch_txt + \" <b>\"+unescape(estr.substring(0,index))+\"</b> \");
estr=estr.substring(index+1,estr.length);
if (estr.substring(0,1) == \"y\")
document.write(\" (\" + exactMatches_txt + \") \");
if (estr.substring(1,2) == \"y\")
document.write(\" (\" + excludingHTML_txt + \") \");
document.writeln(yielded_txt + \":<p>\");
estr=estr.substring(2, estr.length);
index=-1;
var numOfMatches = 0;
var lastindex=0;//colon
var clastindex=0;//comma
var currdata=\"\";
var myurl=\"\";
var myanchor=\"\";
var colonindex=-1;
var info=\"\";
var context=\"\";
var anchor=\"\";
while ((index=estr.indexOf(\",\",index+1)) != -1) {
currdata=estr.substring(clastindex,index);
clastindex=index+1;
colonindex=currdata.indexOf(\":\");
if (colonindex != -1) {
numOfMatches++;
//Get the URL
myurl=unescape(currdata.substring(0,colonindex));
//Get the page\'s title
lastindex=colonindex+1;
colonindex=currdata.indexOf(\":\",lastindex);
document.write(\"<dd><a href=\\\"\"+myurl+\"\\\"> <b>\" +
unescape(currdata.substring(lastindex,colonindex)) +
\"</b> <b>(\"+myurl+\")</b></a>\");
//Get the anchor
lastindex=colonindex+1;
colonindex=currdata.indexOf(\":\",lastindex);
anchor=unescape(currdata.substring(lastindex,colonindex));
if (anchor.length > 0 && displayAnchor)
document.write(\" <a href=\\\"\"+myurl+\"#\"+anchor+\"\\\"> [\" + closestAnchor_txt +\"]</a>\");
document.writeln(\"<br>\");
//Get document info
lastindex=colonindex+1;
colonindex=currdata.indexOf(\":\", lastindex);
info=unescape(currdata.substring(lastindex,colonindex));
document.write(\"<small>\");
if (info.length > 0 && displayDocInfo)
document.write(\"<b>\" + docInfo_txt + \"</b>: \"+info+\" \");
//Get the match context
lastindex=colonindex+1;
context=unescape(currdata.substring(lastindex,currdata.length));
if (context.length > 0 && displayContext)
document.writeln(\"<b>\" + context_txt + \"</b>: \\\"\"+context+\"\\\"\");
document.write(\"</small>\");
document.write(\"<p>\");
}
}
if (numOfMatches == 0)
document.writeln(\"<em><\" + noMatches_txt + \"></em>\");
document.writeln(\"</dl>\");
}
//-->
</script>
</head>
<body>
<table>
<td width=\"100%\" height=\"389\" bgcolor=\"#C0C0C0\" valign=\"top\">
<div align=\"center\">
<p><font face=\"Arial\" size=\"2\"><b>Search Results</b></font><font face=\"Arial\" size=\"1\"><br>
\' <a href=\"index.htm\" target=\"_self\">new search</a> \'</font></p>
</div>
<script language=\"JavaScript\">
<!--
writeResults();
//-->
</script>
<noscript>
This feature requires JavaScript.
</noscript>
<p>
</body>
/morten
