js实现页面转发功能示例代码_javascript技巧
程序员文章站
2022-03-15 08:54:51
...
以下是示例图:
以下是代码:
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();
}
以下是代码:
复制代码 代码如下:
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();
}
下一篇: 微信小程序实现转发功能的实例分析