Leslie Katz wrote:

Here's the code:

<form method="get" action="http://www.google.com/search"; target="new"
onsubmit='document.getElementById("q").value += " inurl:post";'>

<input type="text"   name="q" size="45" id="q"
maxlength="255" value="" />
<input type="submit" style="cursor:pointer; font-size:10px;" value="Google Search" />
<input type="radio"  name="sitesearch" value="" />
Web *
<input type="radio"  name="sitesearch"
value="stumblng.tumblr.com" checked /> The Stumblng Tumblr *<br />

</form>

However, there's a problem with the above. As well as adding "inurl:post" to searches of my blog, it also adds it to searches of the Web, which makes the latter type of search useless.

How can I change the above code so that "inurl:post" is only added to searches of my blog and not to searches of the web?

Javascript supports the C ternary operator
(ref: http://www.webmasterworld.com/forum91/513.htm)
e.g.

a = (b >= 0) ? +1 : -1;

This is untried, but something along the following lines should do it:

<form method="get" action="http://www.google.com/search"; target="new"
onsubmit='document.getElementById("q").value += document.getElementById("sitesearch")=="" ? 
"" : " inurl:post";'>


cheers
rickw


--
_________________________________
Rick Welykochy || Praxis Services

Say what you will about the miracle of unquestioning faith, I consider a capacity for it terrifying and absolutely vile.
    -- Howard W Campbell in Kurt Vonnegut Jr's "Mother Night"
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to