[jQuery] append problem in ie7
hi guys,
Im new to jquery. I have this problem and I think you guys can answer
it. Here's the source code of the file that I am working on. The
purpose of this script is to change the label into different language.
-------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1" />
<title>title</title>
<!-- jQuery -->
<script type="text/javascript" src="js/jquery/jquery-1.2.3.js"></
script>
<style>
html, body {
margin:0px;
padding:0px;
height:100%;
}
#userlist {
border: 1px dashed red;
position: fixed;
top: 20px;
z-index:500;
}
.group-box {
border:1px solid gray;
position:relative;
width: 100px;
height: 40px;
text-align: center;
margin: 5px;
}
.clickables * {
border: 1px solid silver;
background: yellow;
margin: 4px;
width: 100px;
}
#chart-box-container {
border: 2px solid silver;
width: 80%;
height:95%;
margin-left: 100px;
background: white;
z-index:1000;
}
</style>
<script>
// the language resource object
resources = {
"jp": {
"NO_REC": "Wara lecolds",
"EXPLODE": "Warat",
"NAME": "Borat"
},
"en": {
"NO_REC": "There ain't nuthin here dawg.",
"EXPLODE": "See ya!",
"NAME": "Whatcha called"
}
}
</script>
<script type="text/javascript">
function changeLang(lang) {
//alert("Change language to " + lang);
$("multilang").each(function() {
id = $(this).attr("label");
$(this).empty().append(eval("resources." + lang + "." + id));
});
}
$(document).ready(function(){
changeLang("jp");
$(".clickables *").click(function(){
lang = $(this).attr("lang");
changeLang(lang);
});
});
</script>
</head>
<body>
This defaults to Japanese. Click of the language below to change.
<div class="clickables">
<div lang="jp">[Japanese]</div>
<div lang="en">[English]</div>
</div>
<hr/>
This is the string <multilang label='EXPLODE'></multilang>.
<div>It can be anywhere in the DOM of course, like this: <multilang
label='NO_REC'></multilang>. See?</div>
<div>It can be anywhere in the DOM of course, like this: <multilang
label='EXPLODE'></multilang>. See?</div>
<label for="x"><multilang label='EXPLODE'></multilang></label><input
id="x" type="text"/><br/>
<label for="y"><multilang label='NAME'></multilang></label><input
id="y" type="text"/>
</body>
</html>
--------------------------------------------
This work fine in FF. In ie7 I'm getting this error "Unexpected call
to method or property access."
Line: 258
Character: 5
I guess this came from the append function in jquery.
Thanks.