MikoLone
10-13-2005, 10:47 PM
okokokokok,
here is the deal. I have a common button right.
<input type="button" id="myButton" onClick="changeStuff();" value="Change Stuff">
And what the changeStuff function wants to do is change the value and change which function the onClick calls. This is how I think the function would go.
function changeStuff(){
document.getElementById('myButton').value = "Change Back";
document.getElementById('myButton').onClick = changeBack;
}
// and the the changeback function would be like ...
function changeBack(){
document.getElementById('myButton').value = "Change";
document.getElementById('myButton').onClick = changeStuff;
}
So I have tried this and it doesn't work so my question is how do you change the function the button calls onClick dynamically. Can it be done.
Thanks for the responses.
here is the deal. I have a common button right.
<input type="button" id="myButton" onClick="changeStuff();" value="Change Stuff">
And what the changeStuff function wants to do is change the value and change which function the onClick calls. This is how I think the function would go.
function changeStuff(){
document.getElementById('myButton').value = "Change Back";
document.getElementById('myButton').onClick = changeBack;
}
// and the the changeback function would be like ...
function changeBack(){
document.getElementById('myButton').value = "Change";
document.getElementById('myButton').onClick = changeStuff;
}
So I have tried this and it doesn't work so my question is how do you change the function the button calls onClick dynamically. Can it be done.
Thanks for the responses.