Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
1 to 10 of 10
That's because you have defined the stateChanged() function twice.
First time in here: <script src="selectcolor.js"></script> and the second time in here: <script src="selectdescription.js"></script>
Renaming them to colorStateChanged and descriptionStateChanged, or something, should do the trick, but there's still more work to be done, as you seem to be doing everything two times. If you passed the name of the required PHP file as a parameter to your show function, you could trim down a lot of unnecessary repetition.
There are better ways to do this, but you could get rid of the other js file, replace the function showColor(str) line with
function showColor(str, getFile)
and then replace the line
var url="getcolor.php?ID="
with
var url=getFile+"?ID="
and then finally change the function calls to
showColor(this.value, 'filename.php')
Now, does this actually work? I have no idea, but you should get the point, at the very least.
How about making these changes to the JS
function showColor(str, getFile, div)
xmlHttp.onreadystatechange=DescriptionstateChanged(div)
function DescriptionstateChanged(div)
document.getElementById(div).innerHTML=xmlHttp.responseText
and this one to the HTML
showColor(this.value, 'filename.php', 'txtColor')
Sorry about that. Try
xmlHttp.onreadystatechange=function() { DescriptionstateChanged(div); };
instead.
1 to 10 of 10