高分求助!!如何拖动列表项? ondrag event can't be binded to "option"! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用js或者jsp实现也可以同样送分 晕菜,楼主想象力丰富,阿信都说不可以了,jsp——更离谱了 <select id=test size=7 onmousedown="this.dragenable=true;this.setCapture();curOption=this.options[getIndex(this)]" onmousemove="if(this.dragenable==true)swapOption(this)" onmouseup="this.dragenable=false;this.releaseCapture();this.releaseCapture();"><option>选项一</option><option>选项二</option><option>选项三</option><option>选项四</option><option>选项五</option><option>选项六</option><option>选项七</option></select><button onclick="up(test)">向上</button><button onclick="down(test)">向下</button><script>var curOption=new Option();function up(obj){if(obj.selectedIndex!=-1) {var obj1=obj.options(obj.selectedIndex);if (obj.selectedIndex>0)obj1.swapNode(obj1.previousSibling);}}function down(obj){if(obj.selectedIndex!=-1) {var obj1=obj.options(obj.selectedIndex);if (obj.selectedIndex<obj.options.length-1)obj1.swapNode(obj1.nextSibling);}}function swapOption(obj) {if(curOption!=null && curOption!=obj.options[getIndex(obj)] && getIndex(obj)>-1 && getIndex(obj)<obj.size)curOption.swapNode(obj.options[getIndex(obj)]);}function getIndex(obj) {var theIndex=Math.floor((event.offsetY+2)/(obj.offsetHeight/obj.size));if(theIndex<0)theIndex=0;else if(theIndex>obj.options.length)theIndex=obj.options.length;return theIndex;}</script> 我是说阿信没有提到,不是说他说不可以。谢谢 西风瘦马不过我不知道button1和2是作甚么用的而且在拖动时有时会看到错误的顺序如果我把7拖到1,在放开鼠标以前我有把7向下拖则顺序就乱了请赐教 为什么我用getElementById得到的对象属性为空呢? 请问如何用js验证当前gridview里面一条数据都没有? Javascript代码改变div style属性第一次可以,页面刷新后就不行了!求教! 一个js的简单问题。。想不明白 大家帮忙看看 如何禁止运行已经添加的js? 求助JS问题 想学框架 100分求滚动新闻图片的代码 请教eval语法问题 如何实现点击窗口里任何位置,就关闭该窗口! 请问如何用一按钮单击事件,将已经“消失”的窗口再重新让它还原显示,请看下面的描述。 怎样不断刷新内容,但又不感觉刷新?
同样送分
<button onclick="down(test)">向下</button>
<script>
var curOption=new Option();function up(obj)
{
if(obj.selectedIndex!=-1) {
var obj1=obj.options(obj.selectedIndex);
if (obj.selectedIndex>0)
obj1.swapNode(obj1.previousSibling);
}
}
function down(obj)
{
if(obj.selectedIndex!=-1) {
var obj1=obj.options(obj.selectedIndex);
if (obj.selectedIndex<obj.options.length-1)
obj1.swapNode(obj1.nextSibling);
}
}function swapOption(obj) {
if(curOption!=null && curOption!=obj.options[getIndex(obj)] && getIndex(obj)>-1 && getIndex(obj)<obj.size)curOption.swapNode(obj.options[getIndex(obj)]);
}function getIndex(obj) {
var theIndex=Math.floor((event.offsetY+2)/(obj.offsetHeight/obj.size));
if(theIndex<0)theIndex=0;
else if(theIndex>obj.options.length)theIndex=obj.options.length;
return theIndex;
}</script>
不过我不知道button1和2是作甚么用的
而且在拖动时有时会看到错误的顺序
如果我把7拖到1,在放开鼠标以前我有把7向下拖
则顺序就乱了
请赐教