promotingspace.net
Sep 3rd 2008, 6:05 am
Hi
I have a form ( with 4 fields for numbers) and want a javascript function to divide the field input by 100 when we go to next field
first i need to know what event should be used
the function should be simple but i don't know how to set the argument
like:
function devideby100(number){
var obj
obj = document.getElementById('myfield')
obj.value='number/100'
}
then my fields will be:
<input type="text" value="" OnEvent='divideby100();'
But I'm sure it won't work. this is my first function in javascript. Please let me know the correct code
Thanks in advance
I have a form ( with 4 fields for numbers) and want a javascript function to divide the field input by 100 when we go to next field
first i need to know what event should be used
the function should be simple but i don't know how to set the argument
like:
function devideby100(number){
var obj
obj = document.getElementById('myfield')
obj.value='number/100'
}
then my fields will be:
<input type="text" value="" OnEvent='divideby100();'
But I'm sure it won't work. this is my first function in javascript. Please let me know the correct code
Thanks in advance