NEO: Suchmaschiene in Frame

Beitrag lesen

Hallo zusammen,

erstmal vorweg, ich bin nicht allzu fit in Javascript. Deswegen hoffe ich auf eure Hilfe.
Ich habe eine Seite, bestehend aus vier Frames. In einem habe ich eine JS-Suchmaschiene eingebaut. Gibt man nun einen Suchbegriff ein, erscheinen die Ergebnisse im selben Frame. Nun der Knackpunkt.
Klickt man nun ein Suchergebnis an, erscheint auch dieser in diesem Frame und die anderen Ergebnisse sind futsch.
Ich möchte erreichen, das das angeklickte Suchergebnis im nebenstehenden Frame geladen wird.
Da ich nicht weiss, welche Variablen ich ändern muss, hab ich mall den Quellcode reingepackt.

Schonmal vielen Dank für eure Hilfe

<TITLE>imu Nav Page</TITLE>
<SCRIPT LANGUAGE="JavaScript" SRC="recon.js">
</SCRIPT>
  <SCRIPT LANGUAGE="JavaScript">
<!--
var divide = new Array();       // Define global variables
var allMatch = new Array();
var anyMatch = new Array();
var urlMatch = new Array();
var indexer = 0;
var all = false;
var count = 0;
var start = 0;
var urlTest = false;

function validate(text) {       // Check for search method.
          // Make sure the user enters something
 var entry = text;       // worthwhile. No extra spaces or
 if (entry.charAt(0) == "+") {      // strings less than 3 characters
  entry = entry.substring(1,entry.length);
  all = true;
  }
 if ((entry.substring(0,4) == "url:") && (all == false)) {
  entry = entry.substring(5,entry.length);
  all = null;
  }
 while (entry.charAt(0) == ' ') {
  entry = entry.substring(1,entry.length);
  document.forms[0].query.value = entry;
  }
 while (entry.charAt(entry.length - 1) == ' ') {
  entry = entry.substring(0,entry.length - 1);
  document.forms[0].query.value = entry;
  }
 if (entry.length < 3) {
  alert("ReCon does not search strings that small. Elaborate a little.");
  document.forms[0].query.focus();
  return;
  }
 convertString(entry);
 }

function convertString(reentry) {      // Split the valid string into an array
  searchArray = reentry.split(" ");
  if (all == false) { allowAny(searchArray); return; }
  if (all == true) { requireAll(searchArray); return; }
  if (all == null) { parseURL(searchArray); return; }
 }

function allowAny(t) {         // Kick off the search, and compare any word
 for (i = 0; i < profiles.length; i++) {     // the user entered with each element in the database
  var anyConfirmation = true;     // The search loops through each search word and
  var compareElement = profiles[i].toUpperCase();   // each database element
  var refineElement = compareElement.substring(0,compareElement.indexOf('|HTTP'));
  for (j = 0; j < t.length; j++) {
   var compareString = t[j].toUpperCase();
   if (refineElement.indexOf(compareString) != -1 && (anyConfirmation)) { // If a match is found,
    anyConfirmation = false;      // put the profile and the
    anyMatch[indexer] = profiles[i];    // and its corresponding
    indexer++;       // URL in an array
    }
   }
  }

if (anyMatch.length == 0) {      // If no matches are found, print a no match
  noMatch();       // HTML document
  return;
  }
 else { formatResults(anyMatch); }     // Otherwise, generate a results document
 }

function requireAll(t) {        // Incite the search, requiring all search terms entered
 for (i = 0; i < profiles.length; i++) {     // be present in order to qualify matches
  var allConfirmation = true;
  var allString = profiles[i].toUpperCase();
  var refineAllString = allString.substring(0,allString.indexOf('|HTTP'));
  for (j = 0; j < t.length; j++) {
   var allElement = t[j].toUpperCase();
   if (refineAllString.indexOf(allElement) == 2) {
    allConfirmation = false;
    continue;
    }
   }
  if (allConfirmation) {
   allMatch[indexer] = profiles[i];
   indexer++;
   }
  }
 if (allMatch.length == 0) {
  noMatch();
  return;
  }
 else { formatResults(allMatch); }
 }

function parseURL(u) {         // Incite the search, looking only in the URL portion of the string
 for (i = 0; i < profiles.length; i++) {
  var urlConfirmation = true;
  var anyURL = profiles[i].toUpperCase();
  var refineAnyURL = anyURL.substring(anyURL.indexOf('|HTTP'),anyURL.length);
  for (j = 0; j < u.length; j++) {
   var urlPart = u[j].toUpperCase();
   if (refineAnyURL.indexOf(urlPart) != 2 && (urlConfirmation)) {
    urlConfirmation = false;
    urlMatch[indexer] = profiles[i];
    indexer++;
    }
   }
  }
 if (urlMatch.length == 0) {
  noMatch();
  return;
  }
 else {
  urlTest = true;
  formatResults(urlMatch);
  }
 }

function noMatch() {        // Dyanmic HTML page with no results
 parent.frames[1].document.clear();
 parent.frames[1].document.open();
 parent.frames[1].document.writeln("<HTML><HEAD><TITLE>imu Ergebnisse</TITLE></HEAD>");
 parent.frames[1].document.writeln("<BODY BGCOLOR=#CCFF >");
 parent.frames[1].document.writeln("<TABLE WIDTH=450 BORDER=0 ALIGN=CENTER><TR>");
 parent.frames[1].document.writeln("<TD VALIGN=TOP><FONT FACE='Arial'size='4'color='RED'><B><DL>");
 parent.frames[1].document.writeln("<HR NOSHADE WIDTH=445>");
 parent.frames[1].document.writeln("'" + document.forms[0].query.value + "' Keine Ergebnisse.");
 parent.frames[1].document.writeln("<HR NOSHADE WIDTH=445>");
 parent.frames[1].document.writeln("</B></TD></TR></TABLE></BODY></HTML>");
 parent.frames[1].document.close();
 clearOut();
 return;
 }

function formatResults(passedArray) {      // Dynamic HTML with results page
 results = passedArray;
 parent.frames[1].document.clear();
 parent.frames[1].document.open();
 parent.frames[1].document.write("<HTML><HEAD><TITLE>imu Ergebnisse</TITLE></HEAD>");
 parent.frames[1].document.writeln("<BODY BGCOLOR=#66CCFF Link=#0000FF Alink=red>");
 parent.frames[1].document.writeln("<TABLE WIDTH=450 BORDER=0 ALIGN=CENTER CELLPADDING=3><TR>");
 parent.frames[1].document.writeln("<HR NOSHADE WIDTH=445>");
 parent.frames[1].document.writeln("<TD VALIGN=TOP><FONT FACE='Arial'><B>");
 parent.frames[1].document.writeln("Search Query: " + parent.frames[0].document.forms[0].query.value + "<BR>");
 parent.frames[1].document.writeln("Search Results: "+ results.length + "</FONT>"+ "<BR><BR>");
 parent.frames[1].document.writeln("<DL>");
 results.sort();
 if (urlTest) {
  for (i = 0; i < results.length ; i++) {
   divide = results[i].split("|");    // Print each URL result as a unit of a definition list
   parent.frames[1].document.writeln("<DT>" +"<FONT FACE='Arial' size='2'>"+"<STRONG>"+ "<A HREF='javascript:void(top.location.href = "rechts.html" + divide[2] + "")'>" + divide[2] + "</STRONG>");
   parent.frames[1].document.writeln("<DD>" + "<STRONG>" + divide[1] + "<P>");
   }
  }
 else {
  for (i = 0; i < results.length ; i++) {
   divide = results[i].split("|");    // Print each profile result as a unit of a definition list
   parent.frames[1].document.writeln("<DT>" +"<FONT FACE='Arial' size='2'>"+"<STRONG>"+ "<A HREF='javascript:window.open(href = "" + divide[2] + "")'>" + divide[0] + "</A>"+"</STRONG>");
   parent.frames[1].document.writeln("<DD>" +"<STRONG>" + divide[1] + "<P>");
   }
  }
 parent.frames[1].document.writeln("</DL>");    // Finish the HTML document
 parent.frames[1].document.writeln("<A HREF='javascript: history.go(-1)'><IMG SRC='back.gif' BORDER=0></A>");
 parent.frames[1].document.writeln("<HR NOSHADE WIDTH=445>");
 parent.frames[1].document.writeln("</TD></TR></TABLE></BODY></HTML>");
 parent.frames[1].document.close();
 clearOut();
 }

function clearOut() {        // Clear the arrays and variables generated from the current search
 allMatch.length = 0; anyMatch.length = 0;
 urlMatch.length = 0; divide.length = 0;
 indexer = 0; all = false;  urlTest = false;
 document.forms[0].query.select();
 }

//-->
</SCRIPT>
 </HEAD>
<body  bgcolor="#66ccff" Link="#FFFF00 vLink="maroon" aLink="green" TEXT="white" onLoad="document.forms[0].query.focus();">
  <TABLE  BORDER="0" ALIGN="CENTER">
<TR>
<TD width="250" >
<FORM NAME="search" onsubmit="validate(document.forms[0].query.value); return false;" target="_top">
<INPUT TYPE=TEXT NAME="query" SIZE="30">
<INPUT TYPE=HIDDEN NAME="standin" VALUE="">
</FORM>
</TD>
<td valign="top"><font face="Arial" size="3" color="black">Suchbegriff(e) eingeben... Entertaste</font></td>

</TR>
</TABLE>
 </body>
</HTML>