Those. 6 can't find javascript definitions
I have a javascript file a.js, its content sometimes looks like
window.model={};
model.init=(
function(){return "something"}
)();
in my html files, I have something like this:
<script type="text/javascript" src="path/to/a.js"></script>
<script type="text/javascript">
$(document).ready(function() {
model.init();
});
</script>
in chrome, firefox and ie8 works. but in ie6 or ie7 it won't be modeled like that.
I do not know why. can someone help me.
thank!
i will put a warning
in html:
<script type="text/javascript" src="path/to/a.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert("ie6");
model.init();
});
</script>
in js
alert("ie7");
window.model={};
model.init=(
function(){return "something"}
)();
first prints "ie6" but "ie7" never prints
+3
source to share
2 answers