asgarkz
چهارشنبه 06 اسفند 1393, 20:59 عصر
با سلام خدمت دوستان
با توجه به کد زیر باید خاصیت left در button تغییر بکنه که انجام نمیشه. لطفا راهنمایی کنید.
<head>
<style>
.TextClass
{
position: absolute;
height: 70px;
width: 100px;
left: 20px;
top: 20px;
}
.ButtonClass
{
position: absolute;
height: 70px;
width: 120px;
top: 100px;
}
</style>
</head>
<body>
<input type='text' class='TextClass' id='xText' value='Text'>
<input type='button' class='ButtonClass' id='xButton' value='Button'>
<script type='text/javascript'>
var zText, zButton;
zText = document.getElementById('xText');
zButton = document.getElementById('xButton');
zButton.style.left = zText.style.left + zText.style.width + 50;
</script>
</body>
با توجه به کد زیر باید خاصیت left در button تغییر بکنه که انجام نمیشه. لطفا راهنمایی کنید.
<head>
<style>
.TextClass
{
position: absolute;
height: 70px;
width: 100px;
left: 20px;
top: 20px;
}
.ButtonClass
{
position: absolute;
height: 70px;
width: 120px;
top: 100px;
}
</style>
</head>
<body>
<input type='text' class='TextClass' id='xText' value='Text'>
<input type='button' class='ButtonClass' id='xButton' value='Button'>
<script type='text/javascript'>
var zText, zButton;
zText = document.getElementById('xText');
zButton = document.getElementById('xButton');
zButton.style.left = zText.style.left + zText.style.width + 50;
</script>
</body>