gselvara
08-27-2002, 04:43 AM
Hi,
Please copy and paste the bellow code to a browser. When the page loads if you click the "showPos" button it will show 'Left:0' as the left position of the text box. But actually the left is 120. But if you click the "changeLoc" button and then click the "showLoc" button it will corectly show Left:200. Please help me out here. I dont know why this error is comming. Is it a bug in IE ?
Thanks,
Gavin
<!-- This code works only on IE5.5 -->
<!-- S T A R T -->
<HTML>
<HEAD>
<style>
<!--
.drag{position:relative;cursor:hand; left:120px; top:120px}
-->
</style>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
function showPos(){
//alert( window.text1.style.left );
alert( 'Left : ' + window.text1.style.posLeft );
}
function changeLoc(){
window.text1.style.posLeft = 200;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="text" id=text1 name=text1 class="drag">
<INPUT type="button" value="showPos" id=button1 name=button1 onclick="showPos()">
<INPUT type="button" value="changeLoc" id=button2 name=button2 onclick="changeLoc()">
</BODY>
</HTML>
<!-- E N D -->
Please copy and paste the bellow code to a browser. When the page loads if you click the "showPos" button it will show 'Left:0' as the left position of the text box. But actually the left is 120. But if you click the "changeLoc" button and then click the "showLoc" button it will corectly show Left:200. Please help me out here. I dont know why this error is comming. Is it a bug in IE ?
Thanks,
Gavin
<!-- This code works only on IE5.5 -->
<!-- S T A R T -->
<HTML>
<HEAD>
<style>
<!--
.drag{position:relative;cursor:hand; left:120px; top:120px}
-->
</style>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
<!--
function showPos(){
//alert( window.text1.style.left );
alert( 'Left : ' + window.text1.style.posLeft );
}
function changeLoc(){
window.text1.style.posLeft = 200;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<INPUT type="text" id=text1 name=text1 class="drag">
<INPUT type="button" value="showPos" id=button1 name=button1 onclick="showPos()">
<INPUT type="button" value="changeLoc" id=button2 name=button2 onclick="changeLoc()">
</BODY>
</HTML>
<!-- E N D -->