posts - 3,  comments - 2,  trackbacks - 0
今天在做一个页面的时候,遇到一个问题,添加和更新使用同一个页面,当添加的时候,select可以正常使用,如果是更新,那么要求select的值是指定的,并且不可使用,保存时,该控件的值可以正常保存,大家知道select控件没有readonly属性,但是我们还需要用到该功能,该如何实现呢?
         上网搜索了一下,发现一种不错的方法,贡献给大家,代码如下:
    <select name="projInveSour.phaseType" <c:if test='${method eq "update"}'> onbeforeactivate="return false" onfocus="this.blur()" onmouseover="this.setCapture()" onmouseout="this.releaseCapture()" </c:if>>
        <option value="">全部</option>
        <option value="立项" <c:if test='${projInveSourForm.projInveSour.phaseType eq "立项"}'>selected</c:if>>立项</option>
        <option value="初设" <c:if test='${projInveSourForm.projInveSour.phaseType eq "初设"}'>selected</c:if>>初设</option>
       </select>
红色部分为关键代码,大家参考一下,呵呵
posted on 2009-05-26 17:35 sw0rd 阅读(2713) 评论(2)  编辑  收藏

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


网站导航: