PDA

View Full Version : How to open searchresults in DHTML Window widget



RvdH
01-07-2008, 12:03 PM
1) Script Title: DHTML Window widget (v1.1)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/

3) Describe problem: Open searchresults in Window widget.

First of all i am bad in english writing, but i want to have some help with this script.
It works good, but i want to open search results in that Window widget.

What do i have to change in this form to open search results in the widget?

<form id="searchForm" action # name="searchForm" onsubmit="chooseSearch(); return false;" method="post">

<script>
function chooseSearch(){
s = document.searchForm.engine.options[document.searchForm.engine.selectedIndex].value + document.searchForm.keywords.value
location = s
}
</script>

<input onfocus=" this.value=''" value="Searching for..." name="keywords" size="21"/> <select style="font-family: Verdana; font-size: 10pt; font-weight:" name="engine" size="1">


<option value="http://www.google.nl/search?q="/>Google
<option value=" http://www.google.nl/blogsearch?hl=nl&q="/>Google Blog
<option value="http://images.google.nl/images?hl=en&q="/>Google Afbeeldingen
<option value="#"/>
</select>

<input class="button" value="Search" name="Button" onclick="chooseSearch()" type="button"/>


</form>


Thanks!

RvdH
01-07-2008, 07:35 PM
Anybody? It would be a great help thanks :)

ddadmin
01-08-2008, 12:04 PM
You can get a form to target its results to appear in a DHTML window, yes. See this thread: http://www.dynamicdrive.com/forums/showthread.php?t=19083

RvdH
01-08-2008, 02:36 PM
@ddadmin, thanks for the reply.

I looked to the link you give me,

but i don`t now how to change the form i give above.

I don`t understand the iframe thing, sorry for the don't understanding but i'm just a html beginner.

:)

Please help me to change the above form.

ddadmin
01-10-2008, 06:29 AM
In your form, you don't need to change anything from the default other than to add a target attribute inside the <FORM> tag:


<form target="_iframe-googlebox" action="http://www.mysite.com/submit.php">

<input type="submit" />

</form>

This is assuming the DHTML window to contain the returned form results is already open on your page, by calling something like:


<script type="text/javascript">
var googlewin=dhtmlwindow.open("googlebox", "iframe", "about:blank", "Form results", "width=590px,height=350px", "recal")
</script>

on your page. Or are you looking to only open a DHTML window on demand, when the form is actually submitted?

RvdH
01-10-2008, 12:09 PM
@ddadmin, thanks but:


Or are you looking to only open a DHTML window on demand, when the form is actually submitted?

Thats exactly what i want!

I am sorry to bother you, i only want to open a dhtml window when somebody is searching for something.

ddadmin
01-11-2008, 11:17 AM
Sure, you can have the DHTML window that contains your form results only open when the form is actually submitted by putting the code that opens a DHTML window in a function, and calling it via the onSubmit event of forms. So for example:


<script type="text/javascript">

function loadform(){
formwindow=dhtmlwindow.open("formbox", "iframe", "about:blank", "Form results", "width=590px,height=350px,resize=1,scrolling=1,center=1")
}

</script>

<form target="_iframe-formbox" action="http://www.mysite.com/submit.php" onSubmit="loadform()">

<input type="submit" />

</form>