Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

JavaScript to populate a text box

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

kpm547

Established Member
Impact
1
I have a program that has a save function. To save you input the name into a textbox and press save. I have also shown what the current file name that is being worked on is. I would like to make this filename a link. When the link is clicked, I want it to put the name into the save box so you can save over the existing file.

I'm no javascript genius, so I need some code for it. Does anyone know where I can find some code for this or will anyone post some code that will do this? All I need is to pass the name of the link to the textbox.

Thanks
 
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Nobody has any ideas?

I found this piece of code, but it doesn't work. Could someone fix this up?

Code:
<form name="myForm">
The form's name is: <input type="text" name="text1" size="20">
<br /><br />
<a href="" onClick="myform.text1.value="thename"">push me</a>
</form>

When you click the link I want it to put "thename" into the text box.

Nevermind, figured it out. Here's the code for others that might need something similar.

Code:
<form name="myForm">
The form's name is: <input type="text" name="text1" size="20">
<br /><br />
<a style="color:blue;text-decoration:underline;cursor:pointer;"  onClick="document.myForm.text1.value='thename'">push me</a>
</form>
 
Last edited:
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Switch between accounts
You can now stay logged in to more than one NamePros account in the same browser. Click your avatar, then "Accounts in this browser", to...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back