今天弄了一个下午才把他弄出来,功能是“帝国cms图片增加一个像图片集morepic一样的字段含图片及标题(文字说明)”其实这个问题很简单只是自己粗心大意,现在分享给一些帝国cms新手吧
千万要注意字段字段值,细心看看就能实现:(重点地方我标记一下)
<script>
function domvadd_yspic()
{
var i;
var str='';
var oldi=0;
var j=0;
var addnum=0;
addnum=parseInt(document.add.mvaddnum_yspic.value);
oldi=parseInt(document.add.mveditnum_yspic.value);
for(i=1;i<=addnum;i++)
{
j=i+oldi;
str=str+'<tr><td align="center"><input type="text" name="yspic_1[]" id="yspic_1_'+j+'" value=""><a onclick="window.open(\'ecmseditor/FileMain.php?type=1&classid=<?=$classid?>&infoid=<?=$id?>&doing=1&field=yspic_1_'+j+'\',\'\',\'width=700,height=550,scrollbars=yes\');" title="选择已上传的图片"><img src="../data/images/changeimg.gif" border="0" align="absbottom"></td><td align="center"><input type="text" name="yspic_2[]" id="yspic_2_'+j+'" value=""></td></tr>';
}
document.getElementById("mvadd_yspic").innerHTML="<table width='100%' border=0 cellspacing=1 cellpadding=3>"+str+"</table>";
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#DBEAF5">
<tr><td align="center">设置1</td><td align="center">设置2</td></tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
if($ecmsfirstpost==1)
{
?>
<table width='100%' border=0 cellspacing=1 cellpadding=3>
<?php
$editnum=3;
for($i=1;$i<=$editnum;$i++)
{
?>
<tr><td align="center"><input type="text" name="yspic_1[]" id="yspic_1_<?=$i?>" value=""><a onclick="window.open('ecmseditor/FileMain.php?type=1&classid=<?=$classid?>&infoid=<?=$id?>&doing=1&field=yspic_1_<?=$i?>','','width=700,height=550,scrollbars=yes');" title="选择已上传的图片"><img src="../data/images/changeimg.gif" border="0" align="absbottom"></a></td><td align="center"><input type="text" name="yspic_2[]" id="yspic_2_<?=$i?>" value=""></td></tr>
<?php
}
?>
</table>
<?php
}
else
{
$editnum=0;
if($r['yspic'])
{
$r['yspic']=stripSlashes($r['yspic']);
?>
<table width='100%' border=0 cellspacing=1 cellpadding=3>
<?php
//录入项
$j=0;
$mvf_record=explode('||||||',$r['yspic']);
$mvf_count=count($mvf_record);
for($i=0;$i<$mvf_count;$i++)
{
$j=$i+1;
$mvf_field=explode("::::::",$mvf_record[$i]);
?>
<tr><td align="center"><input type="text" name="yspic_1[]" id="yspic_1_<?=$j?>" value="<?=$mvf_field[0]?>"> <input type="hidden" name="yspic_mvid[]" id="yspic_mvid_<?=$j?>" value="<?=$j?>"><input type="checkbox" name="yspic_mvdelid[]" id="yspic_mvdelid_<?=$j?>" value="<?=$j?>">删</td><td align="center"><input type="text" name="yspic_2[]" id="yspic_2_<?=$j?>" value="<?=$mvf_field[1]?>"></td></tr>
<?php
}
?>
</table>
<?php
$editnum=$j;
}
}
?>
</td>
</tr>
<tr>
<td height="25">扩展数量: <input name="mveditnum_yspic" type="hidden" id="mveditnum_yspic" value="<?=$editnum?>">
<input name="mvnum_yspic" type="hidden" id="mvnum_yspic" value="2">
<input name="mvmust_yspic" type="hidden" id="mvmust_yspic" value="1">
<input name="mvaddnum_yspic" type="text" id="mvaddnum_yspic" value="1" size="6"> <input type="button" name="Submit5" value="输出" onclick="javascript:domvadd_yspic();"></td>
</tr>
<tr>
<td id="mvadd_yspic"></td>
</tr>
</table>