View Single Post
Old 08-17-2012, 12:34 PM   PM User | #1
SACoder
New to the CF scene

 
Join Date: Aug 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
SACoder is an unknown quantity at this point
OnChange issue found when used in conjunction with innerHTML

Hey Guys,

I was wondering if anyone could solve the issue I am currently having.

I am attempting to create a text box using innerHTML between div tags when the value of a scroll down box is 0.

Here stands my code:

Code:
<select name="destination" onchange="dest(document.signoutForm.destination.options[document.signoutForm.destination.selectedIndex].value);">
Code:
function dest(destination){
	if(destination == 0){document.getElementById("demo").innerHTML="<input type=\"text\" name=\"dest\" />";
	}else {
		document.getElementById("demo").innerHTML=" ";
	}
}
I have attempted changing the function which calls the method (i.e. to onclick, onkeyup, etc.) but alas, no success.

The textbox is created when the destination is == 0 however once the function has been called and the text box been created, the function is not called again (I have tested this with various alert message placed throughout the code).

Anyone have any idea what I can do to solve the issue.

Thanks

SACoder
SACoder is offline   Reply With Quote