-
-
Save xiaojue/1625708 to your computer and use it in GitHub Desktop.
onpropertychange
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<form name="frmMain"> | |
<input name="fireTarget"> | |
<input type="hidden" name="output"> | |
</form> | |
<script> | |
function changeRealElement () { | |
var torgand = document.frmMain["fireTarget"]; | |
var realElem = document.frmMain["output"]; | |
realElem.value = torgand.value; | |
console.log(realElem.value); | |
} | |
function _onload () { | |
var torgand = document.frmMain["fireTarget"]; | |
if(window.attachEvent) { // IE | |
torgand.attachEvent('onpropertychange',changeRealElement); | |
}else{ // Firfox | |
torgand.addEventListener('input',changeRealElement,false); | |
} | |
} | |
_onload(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment