关于动态的为form表单选动态的点击方法

<input name="visible" type="button"

<c:iftest="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>

class="frm_btn"onClick="javascript:actionEvent('visible')"value="上架">&nbsp;&nbsp;

<inputname="disable"type="button"class="frm_btn"

<c:iftest="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>

onClick="javascript:actionEvent('disable')"value="下架">&nbsp;&nbsp;

<inputname="commend"type="button"class="frm_btn"

<c:iftest="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>

onClick="javascript:actionEvent('commend')"value="推荐">&nbsp;&nbsp;

<inputname="uncommend"type="button"class="frm_btn"

<c:iftest="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>

onClick="javascript:actionEvent('uncommend')"value="不推荐">&nbsp;&nbsp;

/*

*这段代码是让form表单相应动态的触发事件,设置方法的默认值是空,选相应的方法触发相应的方法

*<inputtype="hidden"name="method"value="">

*

*

*<c:iftest="${fn:length(pageView.records)<1}">disabled="disabled"</c:if>

*onClick="javascript:actionEvent('commend')"value="推荐">&nbsp;&nbsp;

*/

function actionEvent(methodname){

varform=document.forms[0];

if(validateIsSelect(form.all,form.productids)){

form.action='<html:rewriteaction="/control/product/manage"/>';

form.method.value=methodname;

form.submit();

}else{

alert("请选择要操作的记录");

}

}

/*选择form表单里面的全选是事件

*/

functionallselect(allobj,items){

varstate=allobj.checked;

if(items.length){

for(vari=0;i<items.length;i++){

if(!items[i].disabled)items[i].checked=state;

}

}else{

if(!items[i].disabled)items.checked=state;

}

}

相关推荐