You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

//*************************************************************//******
//**表单元素自动循环填充Jquery效果类
//**创建人CJ
//**创建时间09.3.31
//**调用实例
//=================JS部分==================
/*
$(function(){
var CF = new TPU_Form_CopyForm_CJ;
CF.CopyForm_get_TmpClass = "FormTemplet"; //模板Class
CF.CopyForm_get_ParentClass = "PersonParentDiv"; //填充框Class
CF.CopyForm_get_intSum = 10; //调用模板10次
CF.CopyForm_get_strReplace = "#i#"; //模板中的特殊字符替换
CF.CopyForm_set_Exec(); //执行
});
*/
//=================JS部分==================
//=================HTML部分==================
/*
<div class="FormTemplet"><div id="tmp_#i#">此为模板DIV</div></div>
<p></p><p></p><hr /><p></p><p></p>
<div class="PersonParentDiv">此为填充DIV</div>
*/
//=================HTML部分==================
var TPU_Form_CopyForm_CJ = function()
{
this.CopyForm_get_TmpClass = ""; //模板Class
this.CopyForm_get_ParentClass = ""; //外框Class
this.CopyForm_get_intSum = 0; //循环数量
this.CopyForm_get_strReplace = ""; //替换字符
this.CopyForm_get_HideCountID = "HideCount"; //统计循环次数的隐藏域ID用户服务器端提交到下一页取得元素值默认为HideCount
//执行方法
this.CopyForm_set_Exec = function()
{
var tc = $("."+this.CopyForm_get_TmpClass); //模板对象
var pc = $("."+this.CopyForm_get_ParentClass); //外框对象
var sr = this.CopyForm_get_strReplace;
var hcid = this.CopyForm_get_HideCountID;
var get_Tmp = ""; //叠加循环模板对象
for(i=1;i<(parseInt(this.CopyForm_get_intSum)+1);i++)
{
var reg = new RegExp(sr,"ig");
var tc_html = tc.html(); //复制模板
tc_html = tc_html.replace(reg,i);
get_Tmp = get_Tmp + tc_html;
reg = null;
}
pc.html(get_Tmp);
}
}