| サンプルソース | 
|---|
| <!--HTMLタグ </HEAD>の下に挿入してください。--> | 
| <BODY > <FORM><INPUT size="20" type="text" name="tbox" value="テキストボックス" id="xypos" style="position : absolute;top : 42px;left : 113px;z-index : 1;"> X位置、Y位置<BR> <INPUT type="button" value="150,700" onclick="act('xypos',150,700)"><BR> <INPUT type="button" value="100,500" onclick="act('xypos',100,500)"><BR> <INPUT type="button" value="400,200" onclick="act('xypos',400,200)"></FORM> </BODY>  | 
    
| <!--Javascript <HEAD>と</HEAD>の間に挿入してください。 -->  | 
    
| <SCRIPT language="JavaScript"> <!--eelife function act(Lyid,B_Top,B_Left){ document.all[Lyid].style.top= B_Top; document.all[Lyid].style.left = B_Left; } // --> </SCRIPT>  | 
    
| コメント | 
| ボタンの設置 テキストボックスのスタイルで id名"xypos"、position : absolute、とtop left の 位置を設定します。 onclick で関数 act(Lyid,B_Top,B_Left)にボタンに設定した数値を渡します。 document.all[Lyid].style.top= B_Top ; テキストボックス"xypos"の上からの位置 document.all[Lyid].style.left = B_Left ; テキストボックス"xypos"の左からの位置 で移動します。  |