日期:2014-05-16 浏览次数:20393 次
<form:form id="inputForm" modelAttribute="clazz" action="${ctx}/sys/clazz/save" method="post">
<input type="hidden" name="id" value="${clazz.id}"/>
<fieldset class="prepend-top">
<legend>班级管理</legend>
<div id="messageBox" class="error" style="display:none">输入有误,请先更正。</div>
<table>
<tr>
<td><label for="name" class="field">班级名称:</label></td>
<td><input id="name" name="name" type="text" value="${clazz.name}" class="required"/></td>
</tr>
<tr>
<td><label for="description" class="field">班级简介:</label></td>
<td><textarea id="description" name="description" style="width:550px;height:45px;" >${clazz.description}</textarea></td>
</tr>
<tr>
<td><label for="culture" class="field">班级文化:</label></td>
<td><textarea id="culture" name="culture" style="width:550px;height:45px;">${clazz.description}</textarea></td>
</tr>
<tr>
<td><label for="teacherWords" class="field">教师心语:</label></td>
<td><textarea id="teacherWords" name="teacherWords" style="width:550px;height:45px;">${clazz.description}</textarea></td>
</tr>
<tr>
<td><label for="name" class="field">班级图片:</label></td>
<td>
<img id="imgUrl" src="${clazz.iconUrl}" width="80" height="60" />
<input type="hidden" value="${clazz.iconUrl}" id="iconUrl" name="iconUrl" />
<input id="filePath" type="file" />
<span style="color:red;font-size:8;">只能上传jpg、png、gif格式的图片</span>
<input type="button" value="上 传 " onclick="uploadPhoto();" />
</td>
</tr>
</table>
</fieldset>
<div>
<input id="submit" class="button" type="submit" value="提 交"/>
<input id="cancel" class="button" type="button" value="返 回" onclick="history.back()"/>
</div>
</form:form>
function uploadPhoto() {
var filePath = $("#filePath").val();
if(filePath == null) {
alert("请先选择文件再上传!");
return;
}
var suffix = filePath.substring(filePath.length-3, filePath.length);
if(suffix != "jpg" && suffix != "png" && suffix != "gif") {
alert("请上传jpg、png、gif格式的图片!");
return;
}
$.ajaxFileUpload( {
url : context + "/sys/upload",
secureuri : false,
fileElementId : "filePath",
dataType : "json",
success : function(data, status) {
var url