method="post" class="pageForm required-validate"
enctype="multipart/form-data" id="newsForm"
οnsubmit="if(!func()) return false;return validateCallback(this, dialogAjaxDone);">
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<h2 class="contentTitle">添加</h2>
<form action=${pageContext.request.contextPath}/news.do?method=newsSave
method="post" class="pageForm required-validate"
enctype="multipart/form-data" id="newsForm"
οnsubmit="if(!func()) return false;return validateCallback(this, dialogAjaxDone);">
<!-- 一定要iframeCallback 才能上传附件-->
<div class="pageFormContent" layoutH="97">
<div class="unit">
<label align="right">新闻标题:</label> <input type="text" name="name"
class="textInput required" maxlength="64" />
</div>
<div class="unit">
<label align="right">新闻内容:</label>
<textarea rows="6" cols="50" id="content" name="content" value="" maxlength = "64"></textarea>
</div>
<div class="unit">
<label align="right">新闻图片:</label> <input type="file" id="picture"
name="picture" value="" accept=".png,.jpg" />
</div>
<%-- <div class="unit">
<label align="right">新闻发布人:</label> <select class="combox"
name="admin_id">
<c:forEach var="a" items="${admin}" varStatus="i">
<option value="${a.ID}"
<c:if test="${i.index == 0}">selected="selected"</c:if>>${a.name}</option>
</c:forEach>
</select>
</div> --%>
<!--hsr新闻发布时间改为自动添加当前时间
<div class="unit">
<label align="right">发布时间:</label> <input type="text" name="time"
dateFmt = "yyyy-MM-dd HH:mm"
class="date textInput readonly valid" /> <a
class="inputDateButton" href="javascript:;">选择</a>
</div> -->
</div>
<div class="formBar">
<ul>
<li><div class="button">
<div class="buttonContent">
<button type="submit">Save</button>
</div>
</div>
</li>
<li><div class="button">
<div class="buttonContent">
<button type="button" class="close">Close</button>
</div>
</div>
</li>
</ul>
</div>
</form>
<!--hsr 2015-02-05 图片格式校验 start -->
<script type="text/javascript">
function closeCurrent() {
$.pdialog.closeCurrent();
}
function func(){
var pic = document.getElementById("picture").value;
if(pic == "") return true;
var pos = pic.lastIndexOf(".");
var lastname = pic.substring(pos, pic.length);
var resultName=lastname.toLowerCase();
if (resultName != ".jpg" && resultName != ".png" && resultName != ".bmp" && resultName != ".ico"){
alert("请上传jpg/png/ico/bmp格式的图片!");
return false;
}
return true;
}
</script>
<!-- end -->