当前位置:Gxlcms > JavaScript > js实现页面转发功能示例代码_javascript技巧

js实现页面转发功能示例代码_javascript技巧

时间:2021-07-01 10:21:17 帮助过:415人阅读

以下是示例图:

以下是代码:
代码如下:

function forward()
{
//对发送内容拼接字符串,整理之后发送.
var temp = "";
var array = new Array();
$("#yxdwlb tr").each(function(){
var flag = false;
var user = "";
$(this).find("td").each(function(n){
if(n == 0){
//user = user + $(this).find("input").is(":checked") +"," ;
flag = $(this).find("input").is(":checked");
}
if(n == 1){ user = user + this.innerText + ",";}
if(n == 2){ user = user + $(this).find("input").val() + ",";}
if(n == 3){ user = user + $(this).find("input").is(":checked") + ",";}
if(n == 4){ user = user + $(this).find("input").is(":checked")+ ";";}
});//列
if(flag == true){
array.push(user);
}
});//行
for(var i = 0 ;i{
temp = temp + array[i];//把数组的原素拼装成字符串存入temp变量,
}
$("#array").val(temp);//temp变量存入参数array
//description不为空的判断
var description=jQuery("#description").val();
if(trim(description)=='') {
triman.alert("请输入描述内容!");
return;
}
//获得表单内容并转发
var doc = document.getElementById("document");
doc.action = "${pageContext.request.contextPath}/documentManager/save";
doc.method = "post";
doc.submit();
}

人气教程排行