Created
January 30, 2011 23:47
-
-
Save frasten/803433 to your computer and use it in GitHub Desktop.
IE, getElementById, gli id e le variabili omonime
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> | |
<head> | |
</head> | |
<body> | |
<div id="mario"></div> | |
<script type="text/javascript"> | |
// Questo da errore | |
mario = 1; | |
// Questo invece no! | |
// var mario = 1; | |
/* | |
Motivazione: nel primo caso IE, essendo notoriamente scemo, tenta | |
di assegnare all'oggetto con id 'mario' il valore 1. | |
Ha questo una spiegazione scientifica? Ovviamente no. | |
Deve la gente continuare ad usare IE? Ovviamente no. | |
Continua la gente ad usare IE? Ovviamente si'. | |
*/ | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Approfondimento