this is a very very strange problem...
see this code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN">
<head>
<title>TEST</title>
<script src="http://misc.fandongxi.com/js/jquery.1.4.js" type="text/javascript"></script>
</head>
<body>
<a href="#" id="p1">click this to change p1.x</a>
<a href="#" id="p2">click this to change p2.x</a>
<input id="p1_val" value="">
<input id="p2_val" value="">
<script language="JavaScript">
a = function(id) {
this.inputid = id+'_val';
othis = this;
$('#'+id).click(function(){
othis.x += 1;
$('#'+othis.inputid).val(othis.x);
});
}
p1 = new a('p1');
p1.x=1;
p2 = new a('p2');
p2.x=1;
</script>
</body>
</html>
i wanna click the ID "p1" to make p1.x add 1,and Click the "P2" to make p2.x add 1
but
the problem is click any of them...the p2.x will add 1
waiting for answer....
very thank you:)
i am not good at english....maybe i don't make the problem clearly;