Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Javascript troubles.
  
User name:
Password:
Reply:
 

UserPost
HyperLamer
Posts: 2619/8210
Well poop, I can't believe I missed that.
Euclid
Posts: 124/193
I think i know what the problem is.

function google(mode) google function, fine.

document.google.term.value; I suppose the form is called google? and term is a text box in the form.

a function and a form called google... you sure you can do that?
HyperLamer
Posts: 2581/8210
Bleh, programming can be a pain sometimes.

I'm trying to write a Google Search function for a page. In a script tag, I have this (just a test so far):

function google(mode)
{
var s="http://www.google.ca/" + mode + "?num=100";
if(document.google.safe.checked)
{
s += "&safe=active";
}
else
{
s += "&safe=off";
}
s += "&q=" + document.google.term.value;
alert(s);
}


Then in a form I have two buttons which call "google('search')" and "google('images')" in onclick, and return false to prevent that stupid thing where it ignores the script and just redirects to the same page with some parameters added on. When I click the buttons, I get the error "google is not a function" and it acts as if it returned true. But what bugs me is if I type "javascript:google('images')" into the URL bar, it works fine! It recognizes the google function, so why don't these buttons?
Acmlm's Board - I2 Archive - Programming - Javascript troubles.


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.009 seconds.