Hi,
I am working on having a button click and then it will paste code into a selected box.
I am having a little bit of an issue though.
First my code:
Two things:
1) It will only paste into the box that has an id of 'answer' instead of a selected box.
Can anyone help me with this?
Thanks!!
Cheers,
Michael
I am working on having a button click and then it will paste code into a selected box.
I am having a little bit of an issue though.
First my code:
Code:
<html>
<head>
<script type="text/javascript">
function check(browser)
{
document.getElementById("answer").value=browser;
}
</script>
</head>
<body>
<form>
<input type="button" onclick="check(this.id)" id='<a href="http://bikramhotyoga.ca/index.php/instructors/michael-ashton/">Michael</a>' value="Michael"<br />
<input type="button" onclick="check(this.id)" id='<a href="http://bikramhotyoga.ca/index.php/instructors/dan-durand/">Dan</a>' value="Dan"<br />
<input type="button" onclick="check(this.id)" id='<a href="http://bikramhotyoga.ca/index.php/instructors/barb-towell/">Barb</a>' value="Barb"<br />
<input type="button" onclick="check(this.id)" id='<a href="http://bikramhotyoga.ca/index.php/instructors/gulie-ajania/">Gulie</a>' value="Gulie"<br />
<br /><br />
The teacher is: <input type="text" id="answer" size="20">
The teacher is: <input type="text" id="2" size="20">
</form>
</body>
</html>
1) It will only paste into the box that has an id of 'answer' instead of a selected box.
Can anyone help me with this?
Thanks!!
Cheers,
Michael
Comment