<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="page" uri="/WEB-INF/tlds/paginated.tld"%>
<%@ taglib prefix="priveliege" uri="/WEB-INF/tlds/priveliege.tld"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="../common/language.jsp" %>
<link href="../style/base<%=language_css%>.css" rel="stylesheet" type="text/css" />
<%@ include file="../common/commonJS.jsp" %>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<script type="text/javascript" src="../js/Calendar/WdatePicker.js"></script>
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../jsCBB/jquery.js" ></script>
<script type="text/javascript" src="../js/jquery.validate.js"></script>
<script type="text/javascript" src="../js/ex.jquery.validate.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
/* 设置默认属�?*/
$.validator.setDefaults({
submitHandler: function(form) {
form.submit();
}
});
$("#addChannelResource").validate({
rules: {
"resources":{
required: true
}
},
messages: {
"resources":{
required: '<s:text name="msg.portalMS.channelMgr.resource.upload.invalid" />'
}
},
errorPlacement: function(error, element) {
element.next().hide();
error.appendTo( element.parent() );
}
});
});
</script>
<script type="text/javascript">
var currentnum = 1; //需要新增的单元格的行号,每次新增后需要向后递增�?
function changeStyle()
{
var table = document.getElementById("inputtable");
var rowNum = document.getElementById("inputtable").rows.length;
//修改行的风格
for (var i = 1; i < rowNum; i++)
{
var row = table.rows[i];
var td = row.cells[0];
if(i % 2 == 1)
{
row.className = 'bule';
}
else
{
row.className = null;
}
}
}
function addRow()
{
var table = document.getElementById("inputtable");
var newtr = table.insertRow(currentnum);
currentnum += 1;
var td1 = newtr.insertCell(-1);//插入标题单元�?
var td2 = newtr.insertCell(-1);//插入内容单元�?
//写入内容
td1.innerHTML = '<s:text name="msg.portalMS.channelMgr.choose.resource.upload"/>';
var input = document.createElement("input");
var addButton = document.createElement("input");
var delButton = document.createElement("input");
var span=document.createElement("span");
input.type = "file";
input.name = "resources";
input.contentEditable="false";
addButton.type = "button";
addButton.value = '<s:text name="msg.portalMS.channelMgr.resource.addmode"/>';
addButton.onclick = function(){addRow()};
setButtonStyle(addButton);
delButton.type = "button";
delButton.value = '<s:text name="msg.portalMS.channelMgr.resource.delete"/>';
delButton.onclick = function(){delRow(this)};
setButtonStyle(delButton);
td2.appendChild(input);
td2.appendChild(span);
td2.appendChild(addButton);
td2.appendChild(delButton);
changeStyle();
}
function setButtonStyle(button)
{
button.style["width"]="66px";
button.style["height"]="20px";
button.style["margin-top"]="5px";
button.style["padding"]="0";
}
//删除�?
function delRow(obj){
var tr = this.getRowObj(obj);
if(tr != null){
tr.parentNode.removeChild(tr);
}else{
throw new Error("the given object is not contained by the table");
}
currentnum -= 1;
changeStyle();
}
//得到行对�?
function getRowObj(obj)
{
var i = 0;
while(obj.tagName.toLowerCase() != "tr"){
obj = obj.parentNode;
if(obj.tagName.toLowerCase() == "table")return null;
}
return obj;
}
</script>
</head>
<body>
<s:form action="addChannelResource" theme="simple" enctype="multipart/form-data" validate="false" namespace="/channel">
<s:hidden name="channel.resourceId"></s:hidden>
<s:hidden name="channel.cityId" id="channel_cityId" />
<div class="r_main">
<div class="r_nav">
<div class="left"><img src="../images/nav_l.gif" width="5" height="29" /></div>
<div class="ct"><s:text name="msg.portalMS.webmgr.current.location" /> <s:text name="msg.portalMS.businessmanagement.name" /> > <s:text name="msg.portalMS.channelMgr.name" /> > <s:text name="msg.portalMS.channelMgr.add.channel.resource" /></div>
<div class="right"><img src="../images/nav_r.jpg" width="5" height="29" /></div>
</div>
<div class="info_tit">
<div class="left"><s:text name="msg.portalMS.channelMgr.resource.addresources" /></div>
</div>
<div class="page_tb">
<table id="inputtable" width="100%" border="0" cellpadding="0" cellspacing="0" class="in_table">
<tr id="filetr">
<td class="col1 must"><s:text name="msg.portalMS.channelMgr.choose.resource.upload" /></td>
<td> <input type="text" id="txtFileName" name="fileName" readonly="readonly"/>
<s:file name="resources" contentEditable="false" οnchange="$('#txtFileName').val(this.value)" οnclick="this.blur()" οnmοuseοut="$(this).hide();$('#mbutton').attr('num','0')" style="outline:none;position:absolute;width:60px;height:30px; top:0px;filter:alpha(opacity=0);-moz-opacity:0;" />
<font color='gray'></font>
<input id="mbutton" style="width:64px;" type="button" value="<s:text name='msg.portalMS.jsp.file.browse' />" num="0" οnmοuseοver="$('input:file[name=resources]').show();if($(this).attr('num')=='0'){$(this).attr('num','1');$('input:file[name=resources]').css({ top: $(this).offset().top, left: $(this).offset().left-6,outline:'none' })}"/>
<input type="button" οnclick="addRow();" value='<s:text name="msg.portalMS.channelMgr.resource.addmode"/>'
style="width: 66px; height: 25px; margin-top: 5px; padding: 0;" /> <span
id="fileErr" style="padding: 0; color: red"><s:fielderror name="fileError" /></span></td>
</tr>
</table>
<div class="info">
<priveliege:priveliege funCode="addChannelResource">
<input type="submit" value='<s:text name="msg.portalMS.system.ok"/>' />
</priveliege:priveliege>
<input type="button" οnclick="window.location='viewChannelResources.action?channel.resourceId=<s:property value="channel.resourceId" />&channel.cityId=<s:property value="channel.cityId"/>';setTimeout(function(){load()},tipTime);" value='<s:text name="msg.portalMS.system.goBack"/>' />
</div>
</div>
</div>
</s:form>
</body>
</html>