posts - 165, comments - 198, trackbacks - 0, articles - 1
            BlogJava :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理
          問(wèn)題: ? struct 標(biāo)簽沒(méi)有直接與ajax 數(shù)據(jù)兼容互換方法
          解決: 先用struct 動(dòng)態(tài)得到數(shù)據(jù)?,再利用javascrpit 的 function(this) 把值提取 交給 ajax

          需要提交的 struct link 項(xiàng)
          <div2>
          ?????????<html:link????onclick='return action(this)'??????????????????????????//javascript?提交? 參數(shù)為 自己標(biāo)簽?
          ???????????????????????????????action=""???????????????????????????????????????????????????????//屏蔽?struct 提交 但 用 struct 得到 動(dòng)態(tài)值
          ???????????????????????????????paramName="tom"
          ?????????????????????????????? paramProperty="personid"
          ??????????????????????????????paramId="personnelId">
          ?????????????????????????????編輯</html:link>
          ?? <div2/>

          <div1/>

          js 控制

          ????????????
          function?action(obj){
          ????????????????
          var?str?=?obj.getAttribute('href');??????????????????
          ????????????????
          var?id?=?str.substring(?str.lastIndexOf('=')+1,?str.length?);?????????// 取得 href 中的 的值 (由 struct 得到的 動(dòng)態(tài)值?)
          ???????????????????
          var?pars?=?'do=edit&personnelId='+id;
          ????????????????
          new?Ajax.Updater('div1','/rlzy/jcyy/basePersonnelList.do?',{parameters:pars,valScripts:true}); //由 prototype 的 ajax 異步提交
          ????????????????Element.hide(document.getElementById(
          "div2"));
          ????????????????Element.show(document.getElementById(
          "div1"));
          ????????????????
          ????????????????
          return?false;
          ????????????}


          ????????????
          function?action2(){
          ????????????????Element.hide(document.getElementById(
          "div1"));
          ????????????????Element.show(document.getElementById(
          "div2"));
          ????????????}


          ????????
          </SCRIPT>

          rlzy
          /jcyy/basePersonnelList.do? 的頁(yè)面? 就局部加入 頁(yè)面 div1 了
          <INPUT type='button' value="test" onclick="action2();"/>

          感想:? javascript 萬(wàn)能膠水
          主站蜘蛛池模板: 冀州市| 临武县| 南漳县| 延边| 吴旗县| 江都市| 鸡西市| 友谊县| 衡阳县| 常德市| 同仁县| 济阳县| 扎囊县| 忻州市| 景德镇市| 连江县| 瑞丽市| 北川| 夹江县| 呼图壁县| 太仓市| 深水埗区| 通河县| 六安市| 秦安县| 汝城县| 靖宇县| 历史| 凤翔县| 翁源县| 台中市| 鹿邑县| 山阴县| 通渭县| 徐水县| 达孜县| 合水县| 高邑县| 寻甸| 开平市| 石首市|