By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,128 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Google Search not working

P: n/a
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
Sep 20 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

Sep 20 '06 #2

P: n/a
"Richard Cornford" <Ri*****@litotes.demon.co.ukwrote in message
news:11*********************@b28g2000cwb.googlegro 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.

Sep 20 '06 #3

P: n/a
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.
Sep 20 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.