Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Google Search not working

Reply
Thread Tools

Google Search not working

 
 
tshad
Guest
Posts: n/a
 
      09-20-2006
I have the following page I found on the net, but it doesn't work. I get an
error on page.

************************************************** ****************
<html>
<head>

<SCRIPT LANGUAGE=JAVASCRIPT>
function googleSearch() {
if (document.doingasearch.searchbox.value!="") {
window.open("http://www.google.com/search?hl=en&q="; +
document.doingasearch.searchbox.value) ;
}
else {
alert("Please enter something to search.")
}
}
</SCRIPT>
</head>

<body bgcolor="#FFFFFF">
<FORM name="doingasearch" id="doingasearch">
Google
<INPUT name=searchbox type=text size=20>
<INPUT type="button" value="Search" onclick="return googleSearch();">
</FORM>
</body>
</html>
************************************************** ***********************************
I thought maybe the semicolon in the window.open line was the problem but it
wasn't.

Can anyone see the problem with this?

Thanks,

Tom


 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      09-20-2006
tshad wrote:
> I have the following page I found on the net, but it doesn't
> work. I get an error on page.


If you click that "error on page" icon a dialog will appear that will
tell you what the error was. (even if you don't understand it someone
here may).

> ************************************************** **
> <html>
> <head>
>
> <SCRIPT LANGUAGE=JAVASCRIPT>
> function googleSearch() {
> if (document.doingasearch.searchbox.value!="") {
> window.open("http://www.google.com/search?hl=en&q="; +

<snip> ^

That semicolon before the plus sign is a syntax error.

Richard.

 
Reply With Quote
 
 
 
 
tshad
Guest
Posts: n/a
 
      09-20-2006
"Richard Cornford" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> tshad wrote:
>> I have the following page I found on the net, but it doesn't
>> work. I get an error on page.

>
> If you click that "error on page" icon a dialog will appear that will
> tell you what the error was. (even if you don't understand it someone
> here may).


The error I got was:

Line: 20
Error: Object expected
Code: 0

Line 20 is:

<INPUT type="button" value="Search" onclick="return googleSearch();">

Thanks,

Tom
>
>> ************************************************** **
>> <html>
>> <head>
>>
>> <SCRIPT LANGUAGE=JAVASCRIPT>
>> function googleSearch() {
>> if (document.doingasearch.searchbox.value!="") {
>> window.open("http://www.google.com/search?hl=en&q="; +

> <snip> ^
>
> That semicolon before the plus sign is a syntax error.
>
> Richard.
>



 
Reply With Quote
 
Richard Cornford
Guest
Posts: n/a
 
      09-20-2006
tshad wrote:
> Richard Cornford wrote:
>> tshad wrote:
>>> I have the following page I found on the net, but it
>>> doesn't work. I get an error on page.

>>
>> If you click that "error on page" icon a dialog will
>> appear that will tell you what the error was. (even
>> if you don't understand it someone here may).

>
> The error I got was:
>
> Line: 20
> Error: Object expected
> Code: 0
>
> Line 20 is:
>
> <INPUT type="button" value="Search"
> onclick="return googleSearch();">


And the previous button on the dialog will show the syntax error that I
pointed out, which stops the "expected" function from being defined.

Richard.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Try Doing A Google Search For Greg Carr On Google Groups Kevin C Baer Computer Support 4 09-16-2008 10:09 PM
Good Website Search Engines Besides Google Search ... Chris K. HTML 3 06-08-2008 05:46 AM
Google search result like site search!! How? =?Utf-8?B?TGFrc2htaSBOYXJheWFuYW4uUg==?= ASP .Net 3 05-06-2005 02:08 AM
Google search & RAX search Gunjani Computer Support 2 02-14-2005 06:54 PM
Firefox google search bar searches google.de Abso Firefox 3 01-06-2005 10:55 PM



Advertisments