头像图片的选择,如何存到数据库
1.javascript中写函数
<script type="text/javascript"> function ShowImage(page, tag) { var i = 1; var e; var a; while (e = document.getElementById(tag + i)) { a = "image/" + i + ".jpg"; if (a == page) e.style.display = 'block'; else e.style.display = 'none'; i++; } } </script>
2.在body里面写HTML代码
<%String i = "image/3.jpg";%> <%String j = "image/2.jpg";%> <%String k = "image/1.jpg";%> <tr> <td>头像:</td> <td align="left"> <div style="display: block" id="image1"> <img src=<%=j%> width="70" height="77" /> </div> <div style="display: none" id="image2"> <img src=<%=k%> width="70" height="77" /> </div> <div style="display: none" id="image3"> <img src=<%=i%> width="70" height="77" /> </div> </td> <td><select name="head" onchange="ShowImage(this.value, 'image');"> <option selected="selected" value=<%=i%>>头像一 </option> <option value=<%=j%>>头像二</option> <option value=<%=k%>>头像三</option> </select></td> </tr>
完成这些,就可以图片的路径传个servlet,servlet再存到数据库中,
相关推荐
CoderToy 2020-11-16
技术之博大精深 2020-10-16
emmm00 2020-11-17
bianruifeng 2020-11-16
云中舞步 2020-11-12
世樹 2020-11-11
暗夜之城 2020-11-11
张荣珍 2020-11-12
amienshxq 2020-11-14
ASoc 2020-11-14
yungpheng 2020-10-19
loveyouluobin 2020-09-29
尘封飞扬 2020-09-29
Coder技术文摘 2020-09-29
lbyd0 2020-11-17
BigYellow 2020-11-16
sushuanglei 2020-11-12
我心似明月 2020-11-09