|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Writing to a textbox using javascript.
How is it possible to write to a textbox within a form using javascript?
I have a onclick event that goes to my javascipt function, but i can't seem to write to a textbox. Can anyone help please? |
|
#2
|
||||
|
||||
|
Use the following:
Code:
document.FormName.TextBoxName.value = "Whatever you Want to Write"; Where FormName is your form name and TextBoxName is the name of your textbox. |
|
#3
|
||||
|
||||
|
or, to make it more standard:
Code:
document.forms["FormName"].elements["TextBoxName"].value = "Whatever you Want to Write"; |
|
#4
|
|||
|
|||
|
Hi,
Can this also be used for a textbox on another doucument ? for example, the values excist on the default.asp file, but the textbox excist on sku.asp . Thanks |
|
#5
|
||||
|
||||
|
only if they're related as parent window-child window or parent window-frame inside parent. suppose default.asp is the parent, and sku.asp is opened as pop up window from within the parent. so this code in sku.asp will change value of textbox in default:
opener.document.forms["FormName"].elements["TextBoxName"].value = "i'm your child"; as you see, the keyword "opener" is used to access the parent. if you have sku.asp as frame inside default.asp, then such code in sku.asp will change textbox inside the parent: parent.document.forms["FormName"].elements["TextBoxName"].value = "you are my parent window"; here, the keyword is parent as you can see... hope it make things more clear! ![]() |
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Writing to a textbox using javascript. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|