Artificial Intelligence Programming Lab(AIPLab) 討論區

Please login or register.

請輸入帳號, 密碼以及預計登入時間



作者 主題: IE and Firefox move a div  (閱讀 5437 次)


  • 訪客
IE and Firefox move a div
« 於: 四月 01, 2009, 06:00:40 pm »
程式碼: [Select]
<script type="text/javascript">
IE = (document.all);
NS = (navigator.appName=="Netscape");

function MoveDiv(id, num){
  if (IE) {
    es.pixelLeft += num;}
  if (NS||NS6) {
    es.left = parseInt(es.left)+num+"px";}

Within IE, you can use the attribute pixelLeft of tag's style to move.
Within Firefox, you MUST use the attribute left instead of pixelLeft.
In addition, the unit "px" must be added after the number.
« 最後編輯時間: 四月 02, 2009, 01:22:06 pm 由 admin »

SimplePortal Classic 2.0.5