yeafee@夜飛郎

          it's usually better to solve problems with simplicity and finesse rather than muscle.

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            33 隨筆 :: 3 文章 :: 2 評(píng)論 :: 0 Trackbacks


          <! DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.0?Transitional//EN"?"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
          < html? xmlns ="http://www.w3.org/1999/xhtml" >
          < head >
          < meta? http-equiv ="Content-Type" ?content ="text/html;?charset=gb2312" ? />
          < title > Option?Element??Move </ title >
          < style? type ="text/css" >
          <!--
          .STYLE1?
          {} {
          ????color
          : ?#FF0000 ;
          ????font-weight
          : ?bold ;
          }

          -->
          </ style >
          < script? language ="javascript" >
          function ?checkCallCenterChange(sourceSelect,?targetSelect) {
          ????
          ????
          var ?unFinished? = ? " P001,P002,P003 " ;?? // 不可以移動(dòng)的操作項(xiàng)???
          ????? if ?(sourceSelect.selectedIndex? > ? - 1 )? {
          ?????????
          // 遍歷檢查不可移動(dòng)項(xiàng)
          ????????? for ?(i = 0 ;?i? < ?sourceSelect.length;? ++ i) {
          ????????????
          var ?selectedOption? = ?sourceSelect.options[i];
          ????????????
          if ?(selectedOption.selected) {????????????????
          ????????????????
          var ?str? = ?selectedOption.value;????????????????
          ????????????????
          if (isContain(unFinished,str) == 'Y') {
          ?????????????????selectedOption.selected
          = false ;
          ???????????????????alert(
          " 操作項(xiàng)\ "" +selectedOption.text+ " \ " 未完成! " );
          ????????????????}

          ????????????}
          ?
          ????????}
          ????????
          ????}
          ????????
          ????SelectOptionsElementMove(sourceSelect,?targetSelect);????
          }


          function ?isContain(srcStr,str) {
          ??
          var ?flag = " N " ;
          ??
          var ?aryA;
          ??
          if (srcStr.indexOf( " , " ) !=- 1 ) {
          ???????aryA
          = ?srcStr.split( " , " );
          ???????
          for ( var ?i = 0 ;i < aryA.length;i ++ ) {??????
          ???????
          if (aryA[i] == str) {???????????????
          ???????????flag
          = " Y " ;
          ???????????
          continue ;
          ??????}

          ?????}

          ??}
          else {
          ?????
          if (srcStr == str) {
          ??????????flag
          = " Y " ;
          ???????}

          ??}

          ??
          return ?flag;
          }


          function ?SelectOptionsElementMove(sourceSelect,?targetSelect)? {????
          ????
          if ?(sourceSelect.selectedIndex? > ? - 1 ) {
          ????????
          // begin?將sourceSelect.option中的選中項(xiàng)移到targetSelect.option中
          ???????? for ?(i = 0 ;?i? < ?sourceSelect.length;? ++ i) {
          ????????????
          var ?selectedOption? = ?sourceSelect.options[i];
          ????????????
          if ?(selectedOption.selected) {
          ????????????????
          var ?newOption? = ? new ?Option(selectedOption.text,?selectedOption.value);
          ????????????????targetSelect.options[targetSelect.options.length]?
          = ?newOption;
          ????????????}
          ?
          ????????}
          // end
          ????????
          ????????
          // begin?去除sourceSelect?中的選中項(xiàng)
          ???????? for ?(i = sourceSelect.length - 1 ;?i? > ? - 1 ;?i -- ) {
          ????????????
          if ?(sourceSelect.options[i].selected)? {
          ??????????????????sourceSelect.options[i]?
          = ? null ;
          ????????????????}
          ????????????????
          ????????}
          // end
          ????}

          }

          </ script >
          </ head >

          < body >
          < form? name ="fromName" ?method ="post" ?action ="actionName" ?target ="edit" >
          < table? width =100%? border =0? align =center? class ="main-table" >
          < tr? align ="center" >
          ???????????
          < td? >
          ???????????
          < TABLE? border ="0" ?width ="60%"
          ????????????????cellspacing
          ="0" ?cellpadding ="0" ?height ="100%" >
          ????????????????
          < TBODY >
          ????????????????????
          < TR >
          ????????????????????????
          < TD? width ="25%" ?rowspan ="2" ?height ="38" ?align ="center"
          ????????????????????????????valign
          ="middle" > 未被選中
          ????????????????
          ????????????????????????
          < select? name ="unSelectedItem" ?multiple ="multiple" ?size ="7" ?ondblclick ="checkCallCenterChange(this,selectedItem);" ?style ="width:?100%;?height:?110" >
          < option? value ="P001" > 變更一 </ option >
          < option? value ="P002" > 變更二 </ option >
          < option? value ="P003" > 變更三 </ option >
          < option? value ="P004" > 變更四 </ option >
          < option? value ="P005" > 變更伍 </ option >
          < option? value ="P006" > 變更陸 </ option >
          < option? value ="P007" > 變更柒 </ option >
          < option? value ="P008" > 變更拐 </ option >
          < option? value ="P009" > 變更玖 </ option >
          < option? value ="P010" > 變更拾 </ option >
          < option? value ="P011" > 變更11 </ option >
          < option? value ="P012" > 變更12 </ option >
          </ select >
          ????????????????????????
          </ TD >
          ????????????????????????
          < TD? width ="10%" ?align ="center" ?valign ="middle" >
          ????????????????????
          < INPUT???? onclick ="checkCallCenterChange(document.forms[0].unSelectedItem,document.forms[0].selectedItem);" ?type ="button" ?value ="?〉〉" ?name ="B4" >
          ????????????????????????????
          </ TD >
          ????????????????????????
          < TD? width ="25%" ?rowspan ="2" ?height ="38" ?align ="center"
          ????????????????????????????valign
          ="middle" > 被選中
          ????????????????????
          ????????????????????
          < select? name ="selectedItem" ?multiple ="multiple" ?size ="7" ?ondblclick ="checkCallCenterChange(this,unSelectedItem);" ?style ="width:?100%;?height:?110" ></ select >
          ????????????????????????
          </ TD >
          ????????????????????
          </ TR >
          ????????????????????
          < TR >
          ????????????????????????
          < TD? width ="10%" ?align ="center" ?valign ="middle" > ?
          ????????????????????
          < INPUT? onclick ="checkCallCenterChange(document.forms[0].selectedItem,document.forms[0].unSelectedItem);" ?type ="button" ?value ="〈〈?" ?name ="B2" >
          ????????????????????????
          </ TD >
          ????????????????????
          </ TR >
          ????????????????
          </ TBODY >
          ????????????
          </ TABLE >
          ???????????
          </ TD >
          ????????
          </ TR >
          </ table > ????????
          </ body >



          posted on 2007-12-28 16:18 @yeafee 閱讀(808) 評(píng)論(0)  編輯  收藏 所屬分類: JS&HTML

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 那坡县| 察雅县| 湖南省| 德阳市| 内江市| 孟州市| 嘉鱼县| 策勒县| 沿河| 灌云县| 论坛| 甘德县| 黑河市| 武川县| 南涧| 宣威市| 永泰县| 本溪市| 资阳市| 东辽县| 保定市| 曲水县| 大宁县| 昭通市| 阳曲县| 平昌县| 高台县| 景东| 怀集县| 太仆寺旗| 绥芬河市| 富源县| 景谷| 满洲里市| 金坛市| 定陶县| 四会市| 尚志市| 郑州市| 明星| 历史|