zoukankan      html  css  js  c++  java
  • 图片预览

    <!DOCTYPE html>
    <html lang="en">
    <head>
    	<meta charset="UTF-8">
    	<title>Document</title>
    <script src="./jquery-1.3.2.js" type="text/javascript"></script>
    </head>
      <script>
     	$(document).ready(function(){
     		$("#two").click(function(){
     			var value=$("#one").val();
     			if(value==""){
     				alert("地址为空");
     			}else{
     				$(".n").append("<img id='five' src="+value+">");
     				$("#two").click(function(){
     					$(".n").empty();
     					$(".n").append("<img id='five' src="+value+">");
     				})
     			}
     		});
     		$("#three").click(function(){
     			var value=$("#one").val();
     			if(value==""){
     				alert("地址为空");
     			}else{
     				alert(value);
     			}
     		});
     		$("#four").click(function(){
     			$(".e").empty();
     			$(".e").append("<input class='one' id='one' type='file'>");
     		});
     	})
     </script>
    <body>
    <table>
     	<tr>
     		<td>
     			<div class="n"></div>
     			<table>
     				<tr>
     					<td>
     						<span class="o">
     						<span class="e">
     							<input type="file" class="one" id="one" value="">
     						</span>
    	 						<input type="button" class="one" id="two" value="预览图片">
    	 						<input type="button" class="one" id="three" value="图片地址">
    	 						<input type="button" class="one" id="four" value="清除">
     						</span>
     					</td>
     				</tr>
     			</table>
     		</td>
     	</tr>
     </table>
    </body>
    </html>
    

     好像只能在IE下实现 *_*

  • 相关阅读:
    法正(44):鄙视
    法正(43):许攸
    法正(42):孔明
    法正(41):帮派
    法正(40):常委
    法正(39):寡妇
    法正(38):吴苋
    法正(37):刘备
    法正(29):暗弱
    法正(36):花瓶
  • 原文地址:https://www.cnblogs.com/aten/p/9003023.html
Copyright © 2011-2022 走看看