yeafee@夜飛郎

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

            BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            33 隨筆 :: 3 文章 :: 2 評論 :: 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 " ;?? // 不可以移動的操作項???
          ????? if ?(sourceSelect.selectedIndex? > ? - 1 )? {
          ?????????
          // 遍歷檢查不可移動項
          ????????? 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(
          " 操作項\ "" +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中的選中項移到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?中的選中項
          ???????? 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) 評論(0)  編輯  收藏 所屬分類: JS&HTML

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 原平市| 惠东县| 义乌市| 通州市| 囊谦县| 临猗县| 南投县| 民乐县| 万全县| 剑阁县| 南雄市| 灌阳县| 丹阳市| 丹东市| 林周县| 贵港市| 吉安县| 新闻| 泸溪县| 陈巴尔虎旗| 石景山区| 孝昌县| 新平| 乌兰浩特市| 朝阳县| 平江县| 读书| 阿拉善右旗| 湛江市| 鹤山市| 德江县| 丹棱县| 潞西市| 通江县| 富源县| 洛阳市| 上蔡县| 东宁县| 彰武县| 西和县| 汝城县|