OT: Adding "kubuntu-users mailing list" to a search box

Paul Rumelhart godshatter at yahoo.com
Fri Feb 27 19:35:23 UTC 2009


Nigel Ridley wrote:
> Nigel Ridley wrote:
>   
>> I'm still playing with my 'home' page for Firefox and thought that it would be a good idea to be 
>> able to add "kubuntu-users mailing list" to the search box below so that I could just type in my 
>> search word/phrase and get results just from the kubuntu-users mailing list.
>>
>> Any ideas how to implement it? I did try a few experiments but nothing worked so far :-(
>>
>> [code]
>>
>> <form action="http://www.google.com/search" method="get" id="google_general">
>> <p>
>> <input type="text"   name="q" size="31" maxlength="256" id="google_general-input" />
>> <input type="submit" value="Search" />
>> </p>
>> </form>
>>
>> [code]
>>
>> Blessings,
>>
>> Nigel
>>
>>     
>
> I have managed a bit of a kludge:
> [code]
>
> <p>
> Google kubuntu-users mailing list Search<br />
> <span style="font-size: 80%;">Tip: Leave the 'kubuntu-users+mailing+list' phrase intact.</span>
> </p>
>      <form action="http://www.google.com/search" method="get" id="google_general">
>        <p>
> 	<input type="text"   name="q" size="31" maxlength="500" id="google_general-input" 
> value="kubuntu-users+mailing+list " />
> 	<input type="submit" value="Search" />
>        </p>
>      </form>
>
> [code]
>
> It would be nice to be able to *hide* the 'kubuntu-users+mailing+list' in the 'value' field.
> Any ideas?
>
> Blessings,
>
> Nigel
>
>
>   

This is close to what you want, I think:

<script type="text/javascript">
  function prepend ()
  {
    document.forms[0].elements[0].value = "kubuntu-users mailing list " 
+ document.forms[0].elements[0].value;
  }
</script>

<form action="http://www.google.com/search" method="get" 
onsubmit="prepend()">
<input type="text" name="q" size="31" maxlength="256" />
<input type="submit" value="Search" />
</form>

It's not perfect, because if you hit the back button you'll see it 
changed the actual text in the text box.

Paul





More information about the kubuntu-users mailing list