风雨无阻

项目中用到的JS代码

function addDev()
{
 var sFeatures="dialogWidth:700px;dialogHeight:500px;scroll:no;";
 var customerId = document.all['cusId'].value;
 var result= window.showModalDialog('<%=appURL %>/businesspermit/DeviceSelectAction.do?formAction=toAddPage&customerId='+customerId,"",sFeatures);
 if(result!=null )
 {
  <logic:present name="edit" scope="request">
     document.CustomerSetForm.action="<%=appURL %>/businesspermit/CustomerSetAction.do?formAction=toEditBusi&showType=1";
  </logic:present>
   <logic:notPresent name="edit" scope="request">
   document.CustomerSetForm.action="<%=appURL %>/businesspermit/CustomerSetAction.do?formAction=getBusinessSet";
   </logic:notPresent>
  
  // window.location.reload();
  
  CustomerSetForm.submit();
 }
}

这个函数表示:添加新的设备JS函数,window.showModalDialog()会返回一个值result,如果result!=null,则刷新这个页面。
原来是用window.location.reload();刷新页面的,但是这样就不能保留之前页面上输入的数据,为了保留原来输入的数据,换成了
document.CustomerSetForm.action=“”;
CustomerSetForm.submit();
上面的语句表示:让这个页面重新指向另一个action地址,然后提交。这样,用了Struts标签后,以前四输入的数据仍然会保留到返回后的页面了。

注意:在js代码中,可能使用譬如说<logic:present>等标签。

posted on 2008-03-13 09:37 秋枫故事 阅读(280) 评论(0)  编辑  收藏 所属分类: 工作总结


只有注册用户登录后才能发表评论。


网站导航:
 
<2008年3月>
2425262728291
2345678
9101112131415
16171819202122
23242526272829
303112345

导航

统计

常用链接

留言簿(2)

随笔分类

随笔档案

新闻档案

搜索

最新评论

阅读排行榜

评论排行榜