|
Post in Forums
Create a Profile
Upload Pictures
Make Polls
|
Keep a Journal
Meet Friends
Have Fun
It's FREE!
|
|
Sign Up!
|
|
|
Forum Index > Computers & Internet > Web Design & Coding | >> Trying to edit a script, and I need help | | |
|
Lili
Silly Lili
Über-Monkey+ 52741 points


27/F/Sunshine Land, California Join Date: Apr 2005 | eL_TinO said:
gah.. for some reason I thought you were using a <select ..> element.
Try this instead.
<form>
<input type="text" id="Number">
<a href="#" onClick="update_rating(1,document.getElementById('Number').value);return false; ">Click Here</a>
</form>
AWESOME! It works! That is super cool! Thank you so much!

"Give a man a fish, he eats for a day. Teach a man to fish, he eats for a lifetime." | | |
|
eL_TinO
booyaka!
Founder Bogey Man 75157 points


29/M/Las Cruces, New Mexico Join Date: Oct 2004 | Lili said:
I was close before, I had
<form>
<input type="text" id="Number">
<a href="javascript: update_rating(1, document.getElementById('Number').value)">Click Here</a>
</form>
And nothing was happening. I don't even know javascript though really, so I don't know what I was expecting, lol.
for some reason the href="javascript doesn't like to work a lot of times, so I did onClick which works better, but you need the return false
 - Every time you toke up, God kills a Mexican
- Buy stuff at Amazon | | |
|
Lili
Silly Lili
Über-Monkey+ 52741 points


27/F/Sunshine Land, California Join Date: Apr 2005 | eL_TinO said:
for some reason the href="javascript doesn't like to work a lot of times, so I did onClick which works better, but you need the return false
what does return false do?

"Give a man a fish, he eats for a day. Teach a man to fish, he eats for a lifetime." | | |
|
eL_TinO
booyaka!
Founder Bogey Man 75157 points


29/M/Las Cruces, New Mexico Join Date: Oct 2004 | Lili said:
what does return false do?
If you don't have it the browser tries to go to "#". That just tells the browser not to follow the href.
 - Every time you toke up, God kills a Mexican
- Buy stuff at Amazon | | |
|
eL_TinO
booyaka!
Founder Bogey Man 75157 points


29/M/Las Cruces, New Mexico Join Date: Oct 2004 | Lili said:
Does it need to say 'javascript:' first, or can it just right into the code? I have it as onClick='javascript: ...' does it matter?
I would take it out, it doesn't need that.
 - Every time you toke up, God kills a Mexican
- Buy stuff at Amazon | | |
|
Lili
Silly Lili
Über-Monkey+ 52741 points


27/F/Sunshine Land, California Join Date: Apr 2005 | eL_TinO said:
I would take it out, it doesn't need that.
I got close to getting it to work by basically cutting and pasting snippets from other scripts that were doing something similar to what I was trying to do, but when you do that, you end up with other coders quirks in there, lol.
Good to know, I'll take it out. 

"Give a man a fish, he eats for a day. Teach a man to fish, he eats for a lifetime." | | |
|
|
Top
|