Unstoppable Domains

JavaScript to populate a text box

Spaceship Spaceship
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
•••
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
•••
Dynadot — .com Registration $8.99Dynadot — .com Registration $8.99

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Live Options
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back