Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Javascript troubles. | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 2581/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
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? |
|||
Euclid Cheep-cheep Level: 23 Posts: 124/193 EXP: 65528 For next: 2195 Since: 03-15-04 From: Australia Since last post: 24 days Last activity: 7 days |
| ||
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 <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 2619/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
Well poop, I can't believe I missed that. |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Javascript troubles. | | | |