




已閱讀5頁,還剩2頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領
文檔簡介
實現(xiàn)了在兩個多選框內(nèi)移動數(shù)據(jù)項的功能在網(wǎng)頁區(qū)添加以下代碼 .multipleSelectBoxControl span /* Labels above select boxes*/ font-family:arial; font-size:11px; font-weight:bold; .multipleSelectBoxControl div select /* Select box layout */ font-family:arial; height:100%; .multipleSelectBoxControl input /* Small butons */ width:25px; .multipleSelectBoxControl div float:left; .multipleSelectBoxDiv /* (C) , October 2005 Download from This is a script from . You will find this and a lot of other scripts at our website. Terms of use: You are free to use this script as long as the copyright message is kept intact. However, you may not redistribute, sell or repost it without our permission. Thank you! Alf Magne Kalleland */ var fromBoxArray = new Array(); var toBoxArray = new Array(); var selectBoxIndex = 0; var arrayOfItemsToSelect = new Array(); function moveSingleElement() var selectBoxIndex = this.parentNode.parentNode.id.replace(/d/g,); var tmpFromBox; var tmpToBox; if(this.tagName.toLowerCase()=select) tmpFromBox = this; if(tmpFromBox=fromBoxArrayselectBoxIndex)tmpToBox = toBoxArrayselectBoxIndex; else tmpToBox = fromBoxArrayselectBoxIndex; else if(this.value.indexOf()=0) tmpFromBox = fromBoxArrayselectBoxIndex; tmpToBox = toBoxArrayselectBoxIndex; else tmpFromBox = toBoxArrayselectBoxIndex; tmpToBox = fromBoxArrayselectBoxIndex; for(var no=0;notmpFromBox.options.length;no+) if(tmpFromBox.optionsno.selected) tmpFromBox.optionsno.selected = false; tmpToBox.optionstmpToBox.options.length = new Option(tmpFromBox.optionsno.text,tmpFromBox.optionsno.value); for(var no2=no;no2(tmpFromBox.options.length-1);no2+) tmpFromBox.optionsno2.value = tmpFromBox.optionsno2+1.value; tmpFromBox.optionsno2.text = tmpFromBox.optionsno2+1.text; tmpFromBox.optionsno2.selected = tmpFromBox.optionsno2+1.selected; no = no -1; tmpFromBox.options.length = tmpFromBox.options.length-1; var tmpTextArray = new Array(); for(var no=0;notmpFromBox.options.length;no+) tmpTextArray.push(tmpFromBox.optionsno.text + _ + tmpFromBox.optionsno.value); tmpTextArray.sort(); var tmpTextArray2 = new Array(); for(var no=0;notmpToBox.options.length;no+) tmpTextArray2.push(tmpToBox.optionsno.text + _ + tmpToBox.optionsno.value); tmpTextArray2.sort(); for(var no=0;notmpTextArray.length;no+) var items = tmpTextArrayno.split(_); tmpFromBox.optionsno = new Option(items0,items1); for(var no=0;notmpTextArray2.length;no+) var items = tmpTextArray2no.split(_); tmpToBox.optionsno = new Option(items0,items1); function sortAllElement(boxRef) var tmpTextArray2 = new Array(); for(var no=0;noboxRef.options.length;no+) tmpTextArray2.push(boxRef.optionsno.text + _ + boxRef.optionsno.value); tmpTextArray2.sort(); for(var no=0;no)=0) tmpFromBox = fromBoxArrayselectBoxIndex; tmpToBox = toBoxArrayselectBoxIndex; else tmpFromBox = toBoxArrayselectBoxIndex; tmpToBox = fromBoxArrayselectBoxIndex; for(var no=0;notmpFromBox.options.length;no+) tmpToBox.optionstmpToBox.options.length = new Option(tmpFromBox.optionsno.text,tmpFromBox.optionsno.value); tmpFromBox.options.length=0; sortAllElement(tmpToBox); /* This function highlights options in the to-boxes. It is needed if the values should be remembered after submit. Call this function onsubmit for your form */ function multipleSelectOnSubmit() for(var no=0;noarrayOfItemsToSelect.length;no+) var obj = arrayOfItemsToSelectno; for(var no2=0;no2; buttonDiv.appendChild(buttonRight); buttonRight.onclick = moveSingleElement; var buttonAllRight = document.createElement(INPUT); buttonAllRight.type=button; buttonAllRight.value = ; buttonAllRight.onclick = moveAllElements; buttonDiv.appendChild(buttonAllRight); var buttonLeft = document.createElement(INPUT); buttonLeft.style.marginTop=10px; buttonLeft.type=button; buttonLeft.value = ; buttonLeft.onclick = moveSingleElement; buttonDiv.appendChild(buttonLeft); var buttonAllLeft = document.createElement(INPUT); buttonAllLeft.type=button; buttonAllLeft.value = ; buttonAllLeft.onclick = moveAllElements; buttonDiv.appendChild(buttonAllLeft); var subDiv = document.createElement(DIV); subDiv.style.width = (Math.floor(totalWidth/2) - 15) + px; toObj.style.width = (Math.floor(totalWidth/2) - 15) + px; var label = document.createElement(SPAN); label.innerHTML = labelRight; subDiv.appendChild(label); subDiv.appendChild(toObj); parentDiv.appendChild(subDiv); toObj.style.height = (totalHeight - label.offsetHeight) + px; fromObj.style.height = (totalHeight - label.offsetHeight) + px; selectBoxIndex+; 在網(wǎng)頁區(qū)添加以下代碼 Finland France Mexico Norway Spain United Kingdom Canada Germany United States createMovableOptions(fromBox,toBox,500,300,Available countries,Selected countries); 程序調(diào)用說明: 首先類似下面的代碼創(chuàng)建兩個多選框 Finland France Mexico Norway Spain United Kingdom Canada Germany United States 然后調(diào)用一個Javascript函數(shù)進行初始化 createMovableOptions(fromBox,toBox,500,30
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 幼兒美食活動方案
- 庫爾勒三八活動方案
- 幼兒赤足活動方案
- 建筑公司投標策劃方案
- 家具制造工期滯后的趕工措施
- 廣告裝置設計與施工配合措施
- 2025年秋季學期幼兒園教師職業(yè)發(fā)展計劃
- 幼兒園豌豆采摘活動方案
- 幼兒園交通安全活動方案
- 醫(yī)院膳食委員會優(yōu)化計劃
- 《椎動脈型頸椎病》課件
- 巨量云圖(中級)認證考試題庫(附答案)
- 2024年垂直升降貨柜項目可行性研究報告
- 2023年貴州貴州貴安發(fā)展集團有限公司招聘考試真題
- 人文英語4-008-國開機考復習資料
- 公司責任與權(quán)力分配管理制度
- 甘肅電投集團筆試試題
- 部編版四年級語文閱讀訓練20篇專項專題訓練帶答案解析
- 《中歐國際工商學院》課件
- 環(huán)境水利學-001-國開機考復習資料
- 大講堂之 第五講 大一統(tǒng)與中華民族的初步形成秦漢時期《中華民族共同體概論》
評論
0/150
提交評論