下面的脚本供你参考: =================================================== function DoubleBox1_MoveToRight(){ var LeftBox=document.getElementById("DoubleBox1_LeftBox") var RightBox=document.getElementById("DoubleBox1_RightBox") if (LeftBox.options.length>0){ if(LeftBox.selectedIndex>=0){ var DeleteOption=document.createElement("OPTION"); RightBox.options.add(DeleteOption); DeleteOption.innerText=LeftBox.options[LeftBox.selectedIndex].text; DeleteOption.value=LeftBox.options[LeftBox.selectedIndex].value; LeftBox.options.remove(LeftBox.selectedIndex); }} }function DoubleBox1_MoveToLeft(){ var LeftBox=document.getElementById("DoubleBox1_LeftBox") var RightBox=document.getElementById("DoubleBox1_RightBox") if (RightBox.options.length>0){ if (RightBox.selectedIndex>=0){ var DeleteOption=document.createElement("OPTION"); LeftBox.options.add(DeleteOption); DeleteOption.innerText=RightBox.options[RightBox.selectedIndex].text; DeleteOption.value=RightBox.options[RightBox.selectedIndex].value; RightBox.options.remove(RightBox.selectedIndex); }} 移动全部 function DoubleBox1_MoveAllToLeft(){ var LeftBox=document.getElementById("DoubleBox1_LeftBox"); var RightBox=document.getElementById("DoubleBox1_RightBox"); var i=RightBox.options.length-1; while (i!=-1){ var DeleteOption=document.createElement("OPTION");LeftBox.options.add(DeleteOption); DeleteOption.innerText=RightBox.options[i].text; DeleteOption.value=RightBox.options[i].value; RightBox.options.remove(i); i=i-1; }
如果不对他进行编程,用html就可以了
html控件加上runat=server就是web端的控件了(部分的)。
html的控件在客户端执行,web的在server端执行,要占用server的资源。
用html可以在没有必要非要post页面的情况下选用,例如控件的简单校验。
web的控件则有更多的弹性。
vbscript? or c#? c# 可以吗?
有的web可以代替html但是html代替不了web吧~!
在 eSelPagen 列表框中每个 <OPTION> 的 VALUE 属性中,都存储了其他 Web 页的 URL(统一资源定位器):<OPTION NAME="GoA" VALUE="http://msdn.microsoft.com/workshop/">MSDN Online Web Workshop
与 eSelPage 列表框位于同一 <FORM> 中的“Go”“按钮”显示所选的页:<INPUT ID="bGo" type="button" VALUE="Go" NAME="bGo" onClick="goThere(this.form.eSelPage)">
在用户选择“Go”按钮时,bGo <INPUT> 将整个 eSelPage <SELECT> 元素传递到名为 goThere() 的函数中。将如下的函数添加到该页所使用的 <SCRIPT> 中:function goThere(eSelPage) {
var sURL = eSelPage.options[eSelPage.selectedIndex].value;
var newWin = window.open(sURL,'newWin','resizable,scrollbars,menubar,toolbar,location,status');
newWin.focus();
}
这个由三行组成的 goThere() 函数将从当前传递给它的 eSelPage 列表框中选定的 <OPTION> 的 VALUE 属性中检索 URL,在新的 Web 浏览器窗口中显示所调用的 Web 页,并使该新窗口成为活动窗口。
其实在HTML 控件在客户端进行操作都是用javascript or jscript,除不能用vbscript,和以前的asp,php之类的一样操作。c#只能在server端操作,即的有.netframework支持,
htmlcontrol如果想提交一些信息让server端处理可以假如runat=server就行了。
有两个ListBox控件(HTML 控件)listbox1,listbox2,当我点击listbox1中的一项时,这一项就在listbox2中出现,同时在listbox1中去除。
这个功能我在用WEB 控件listbox中可以实现,但是这太占用系统资源,也没有必要。我想在客户端实现,这如何做,用javascript?
有两个ListBox控件(HTML 控件)listbox1,listbox2,当我点击listbox1中的一项时,这一项就在listbox2中出现,同时在listbox1中去除。
这个功能我在用WEB 控件listbox中可以实现,但是这太占用系统资源,也没有必要。我想在客户端实现,这如何做,用javascript?
===================================================
function DoubleBox1_MoveToRight(){
var LeftBox=document.getElementById("DoubleBox1_LeftBox")
var RightBox=document.getElementById("DoubleBox1_RightBox")
if (LeftBox.options.length>0){
if(LeftBox.selectedIndex>=0){
var DeleteOption=document.createElement("OPTION");
RightBox.options.add(DeleteOption);
DeleteOption.innerText=LeftBox.options[LeftBox.selectedIndex].text;
DeleteOption.value=LeftBox.options[LeftBox.selectedIndex].value;
LeftBox.options.remove(LeftBox.selectedIndex);
}}
}function DoubleBox1_MoveToLeft(){
var LeftBox=document.getElementById("DoubleBox1_LeftBox")
var RightBox=document.getElementById("DoubleBox1_RightBox")
if (RightBox.options.length>0){
if (RightBox.selectedIndex>=0){
var DeleteOption=document.createElement("OPTION");
LeftBox.options.add(DeleteOption);
DeleteOption.innerText=RightBox.options[RightBox.selectedIndex].text;
DeleteOption.value=RightBox.options[RightBox.selectedIndex].value;
RightBox.options.remove(RightBox.selectedIndex);
}}
移动全部
function DoubleBox1_MoveAllToLeft(){
var LeftBox=document.getElementById("DoubleBox1_LeftBox");
var RightBox=document.getElementById("DoubleBox1_RightBox");
var i=RightBox.options.length-1;
while (i!=-1){
var DeleteOption=document.createElement("OPTION");LeftBox.options.add(DeleteOption);
DeleteOption.innerText=RightBox.options[i].text;
DeleteOption.value=RightBox.options[i].value;
RightBox.options.remove(i);
i=i-1;
}