sana2009fall
asked on
Slide in Javascript
Hi,
I wanted to move the table based on the input given in left and top columns. But not able to accomplish it.
Can u please help me with this.
Thanks,
Sana
I wanted to move the table based on the input given in left and top columns. But not able to accomplish it.
Can u please help me with this.
Thanks,
Sana
function move(){
var x=this.document.getElementsByTagName('tbody')[0].style;
if(parseInt(x.left)<600){
x.left=parseInt(x.left)+5+'px';
setTimeout('move()',20);
}
}
function changeAll(whichProp,toWhat){
eval("this.document.getElementsByTagName('table')[0].style."+whichProp+"=toWhat");
}
<hr/>
Move<br/>
Left: <input type="text" onchange="changeAll('left',this.value)"/><br/>
Top: <input type="text" onchange="changeAll('top',this.value)"/><br/>
<input type="button" value="move it!" onclick="move()"/>
<hr/>
<table border="3" style="position:absolute; top:30px; left:310px;">
<tr>
<td>text</td><td>text</td>
</tr>
<tr>
<td>text</td><td>text</td>
</tr>
</table>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It works when I am working individually. how do I integrate it with this code ??
The table should move based on the inputs specified in left , top only when the move it button is clicked,
Open in new window