Google Search not working

T

tshad

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
 
R

Richard Cornford

tshad said:
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.
 
T

tshad

Richard Cornford said:
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
 
R

Richard Cornford

tshad said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top