Forum Moderators: open

Message Too Old, No Replies

How to search data in a File and Open Javascript funtion to an iFrame?

Search File; Search Engine; Submit Button; Search Data

         

coolblaze

5:48 pm on Jan 27, 2008 (gmt 0)

10+ Year Member



For example I have html file "words.html" inside that file there is so many words with meaning. In my case I want to search within that file a particular word with the meaning. When I type the keyword in the search area or search engine it will search on that "words.html" file and find the match keyword then list it to iframe.
Does anyone know how please help!

And another question: how to open the code below in iframe?

<input name="searchbutton" type="button" value="Go" onclick="javascript:SearchForWords()">

because when run that code it will open automatically in a different window. but I want it to open in an iframe.

This is the complete code of my project:

<HTML>
<HEAD>
<TITLE>Search</TITLE>

<!-- BEGIN_SEARCH_SCRIPT -->
<!-- Helpware Search data generated by FAR.EXE [helpware.net...] -->
<script language="JavaScript" src="searchdata.js"></script>
<!-- Search Code to find words -->
<script language="JavaScript" src="search.js"></script>
<!-- END_SEARCH_SCRIPT -->

</HEAD>

<BODY bgcolor="white">

<!-- BEGIN_SEARCH_FORM -->
<form name="searchform">
<script language="javascript">
function SearchForWords() {DoSearch('', searchform.searchdata1.value, '', false, 'right');}
function KeyDownEvent() {if ((event.which && event.which==13) ¦¦ (event.keyCode && event.keyCode==13)) {
SearchForWords(); return(false); } else return(true);}
function show() {
document.getElementById('iframe1').src=javascript:SearchForWords();
}
</script>
<b>Search for Word:</b> <br>
<input type="text" name="searchdata1" style="width:180" onKeyDown="javascript:return(KeyDownEvent());">
<input name="searchbutton" type="button" value="Go" onclick="javascript:show()">

</form>
<!-- END_SEARCH_FORM -->

<table width=40% cellpadding=4 cellspacing=0 border=0>
<form name=form>

<tr>
<td nowrap>
<select name="fieldname" size="1"
onChange="window.open(this.options[this.selectedIndex].value,'iframe1')">
<option value="PSL.htm"> </option>
<option value="A_option.htm">A</option>
<option value="index.htm">B</option>
</select>
</td>
<b>Select By Letters</b> </tr>
</form>
</table> <!--End of jumpMenu-->

<table>
<tr>
<td width="220" valign="top">
<p align="center">
<!-- ####################### start of iframe tags ####################### -->
<!-- ####################### the text between the start and end tags of the iframe is similar to the noframes tag in regular frames ####################### -->
<iframe name="iframe1" src="PSP Dictionary.htm" align="top" height="200" width="250" hspace="10" vspace="10">
If you can see this, your browser does not support iframes!
</iframe>
<!-- ####################### end of iframe tags ####################### -->
</td>
</tr>
</table>

</BODY>
</HTML>

daveVk

11:19 pm on Jan 27, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



re second part of question

change

onChange="window.open(this.options[this.selectedIndex].value,'iframe1')">

TO

onChange="document.frames['iframe1'].src = this.options[this.selectedIndex].value;"

daveVk

2:55 am on Jan 28, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



re first part of question

You need to consider how large "words.html" is, if large then best to do the search on the server rather than in javascript, otherwise download time must be considered.

If you wish to do it on the client, consider loading "words.html" into hidden iframe so that it does not need to downlosd on each of your pages.