Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Markup (HTML, XHTML, XML) _ Help with this form? (Beginner)

Posted by: slowbro Dec 14 2011, 07:26 PM

Here's what I have:

CODE
</form>
<script type="text/javascript">
var domainroot="(site:www.example.com)"

function Gsitesearch(curobj){
curobj.q.value=domainroot+" "+curobj.qfront.value
}

</script>


<form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)">

<p><b>Search Site<br />
<input name="q" type="hidden"/>
<input name="qfront" type="text" style="width: 180px" /> <input type="submit" value="Search" /></b></p>

</form>


This code sends you to google and searches what you put in the form, but my goal is to put the google search in an iframe (or something more aesthetically pleasing) on my site. It can't be that difficult because I see it on almost every site I visit. Can anybody help me, or send me a site that will help with this?

Thanks very much,

-T

Posted by: pandy Dec 15 2011, 01:08 AM

Use the target attribute.
http://htmlhelp.com/reference/html40/forms/form.html
http://htmlhelp.com/faq/html/frames.html#frame-target

Posted by: slowbro Dec 15 2011, 10:30 AM

Thanks so much!

Posted by: Christian J Dec 15 2011, 10:54 AM

Side-note: should you have parenthese here:

CODE
var domainroot="(site:www.example.com)"

? I don't think Google uses them.


Posted by: slowbro Dec 15 2011, 04:16 PM

QUOTE(Christian J @ Dec 15 2011, 10:54 AM) *

Side-note: should you have parenthese here:

CODE
var domainroot="(site:www.example.com)"

? I don't think Google uses them.


Oh you're right, thanks!

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)