|
-
Jul 19th, 2005, 06:45 AM
#1
Thread Starter
Frenzied Member
JavaScript -- Setting value in textfield{resolved}
I'm trying to make a simple calculator and whenever I want to add text to the textfield(say a number) it will show up, then will dissapear.
Code:
function display(number)
{
var x = document.form1.displayText;
x.value = number;
}
This is how I'm doing it, but why is the text dissapearing right after it appears?
Note: This method is called whenever one of the number buttons is clicked.
Last edited by System_Error; Jul 20th, 2005 at 10:57 AM.
-
Jul 19th, 2005, 08:03 AM
#2
Addicted Member
Re: JavaScript -- Setting value in textfield
hi
the code is correct and it should work fine. there must be some function or something which must be refreshing the textbox. check it out.
--Kishore...
-
Jul 20th, 2005, 09:56 AM
#3
Member
Re: JavaScript -- Setting value in textfield
The only thing I can think of without seeing any other code, is maybe you have the buttons as submit buttons: <input type="submit"> instead of buttons:<input type="button">
And it's submitting the form right after you click it.
-
Jul 20th, 2005, 10:57 AM
#4
Thread Starter
Frenzied Member
Re: JavaScript -- Setting value in textfield
And that's exactly what was wrong!!!! Thank you!!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|