Drag and Drop between two select Objets

<script language="javascript" src="javascript.js" type="text/javascript"></script> <script language="javascript" src="xml_load.js" type="text/javascript"></script> <script language="javascript" src="/alain/js/download.js" type="text/javascript"></script> <script type="text/javascript"> var MyLang; if (ns6 == true) { MyLang=window.navigator.language; } else { MyLang=window.navigator.userLanguage; } if ( MyLang != 'fr') { MyLang='C'; } </script>  

Drag and Drop between two select Objets

Move one element and you will see the select objects follow the element drap or drop

home Home
Drag Elements Drop Elements
ça
m'amuse
excellent
super
bien
bon
well
good
very
it's
funny
You can drap and drop or the form
 
The select ObjectsDrag Drop
<script language="javascript" type="text/javascript"> function hidden_selects () { if (document.getElementById('selects').style.visibility=='hidden') { document.getElementById('selects').style.visibility='visible'; document.getElementById('bt1').value='hide /"select Objects/"'; } else { document.getElementById('selects').style.visibility='hidden'; document.getElementById('bt1').value='show /"select Objects/"'; } } </script>
If you want to do the same thing you must do this :
  • You must load the javascript DragAndDrop.js
  • In your HTML page put on tag body
      <body οnlοad="_initDragEtDrop(event)"> 
     
  • In your HTML page you must create one div 't1' where you want to print the Drag and Drop
     <div id="t1" > < /div>
  • In your HTML page you must load the script "DragAndDrop.js" with instruction :
     <script src="DragAndDrop.js" type="text/javascript" language="javascript"></script>
  • In your page HTML you must have 2 tags <select> named "drag" and "drop", like this
     <select name="drag" .... >
    <select name="drop" .... >
  • If you want put a "Reset Button", you can use the function ResetDragAndDrop(event), like this
     <input type="button" value="reset" on click="ResetDragAndDrop(event)" />
    

An example

<html>
<head>
</head>
<body οnlοad="_initDragEtDrop(event)">

<div id="t1">
<br>
<br>
<br>
<br>
Drag et Drop
</div>
<form>
<div style="display: none; visibility: hidden">
<select name="drag" >
        <option value="bon">bon</option>
        <option value="aimable">aimable</option>
</select>
<select name="drop">
        <option value="mauvais">mauvais</option>
        <option value="drole">drole</option>
</select>
</div>
<input type="submit" οnclick="print_your_choice('drag'); print_your_choice('drop')"/>
</form>



<script type="text/javascript">
function print_your_choice(elem)
{
var select=document.getElementsByName(elem)[0];
var o=select.options;
var v=' ';
for (i=0;i<o.length;i++) {
        v=v+' '+o[i].value;
}
alert(elem+'='+v);
}
</script>
<script src="DragAndDrop.js" type="text/javascript" language="javascript"></script>

</body>
</html>

src="/php/setinfoip.php">
<script language="javascript" src="DragAndDrop.js" type="text/javascript"></script> <script type="text/javascript"> function vide(){} setTimeout('setContent()',1000); loadXMLDoc('DragAndDrop.xml',vide); </script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值