h8ids
06-06-2007, 04:42 PM
I have an INPUT field which calls the following function; dup.
The function should do two things:
1) write the field value to the page - This works beautifully
2) share textfield INPUT value with INPUT radio button - Not working
I can't give both INPUTs the same id.
<script>
function dup(what)
{
//THIS WORKS BEAUTIFULLY
var createText = document.createTextNode(what);
var cell = document.getElementById('sameName');
if(cell.hasChildNodes())
{ while(cell.childNodes.length >= 1 )
{ cell.removeChild( cell.firstChild ); } }
cell.appendChild(createText);
//PROBLEM CODE HERE - trying to share value of Instructor with FacultyName
var Teacher = document.forms["form1"]["Instructor"];
document.forms["FacultyName"] = Teacher.value;
}
</script>
<!-- INPUT textfield -->
<input id="Instructor" type="text" name="Instructor" value="" onBlur="dup(this.value)">
<!-- Radio button INPUT -->
<input checked type="radio" name="FacultyName" id="Name" value="">
The function should do two things:
1) write the field value to the page - This works beautifully
2) share textfield INPUT value with INPUT radio button - Not working
I can't give both INPUTs the same id.
<script>
function dup(what)
{
//THIS WORKS BEAUTIFULLY
var createText = document.createTextNode(what);
var cell = document.getElementById('sameName');
if(cell.hasChildNodes())
{ while(cell.childNodes.length >= 1 )
{ cell.removeChild( cell.firstChild ); } }
cell.appendChild(createText);
//PROBLEM CODE HERE - trying to share value of Instructor with FacultyName
var Teacher = document.forms["form1"]["Instructor"];
document.forms["FacultyName"] = Teacher.value;
}
</script>
<!-- INPUT textfield -->
<input id="Instructor" type="text" name="Instructor" value="" onBlur="dup(this.value)">
<!-- Radio button INPUT -->
<input checked type="radio" name="FacultyName" id="Name" value="">