话不多说,直接上代码:
1.前端页面效果图
2.页面html代码
<form id="newsForm" name="newsForm" action="" method="post">
<table>
<tr>*标题:</tr>
<span id="spanTitle"></span><br/>
<tr><input type="text" id="inputTitle" name="news_title" placeholder="请填写新闻标题(必填)" onblur="checkTitle()"/></tr>
<br/>
<tr>*内容:</tr>
<span id="spanContent"></span><br/>
<tr>
<textarea id="inputContent" name="news_content" placeholder="请填写新闻内容(必填)" onblur="checkContent()"></textarea>
</tr>
<br/>
<tr>*配图:</tr>
<br/>
<input type="file" name="files" multiple="multiple" accept="image/jpeg , image/jpg , image/png"
onchange="viewImage(this)"/><br/><br/>
<tr>*图片预览:</tr>
<div style="height:160px;">
<img src="" class="preview"/>
<img src