jquery review image
I want to put the image url into an input box, after click the botton, I can review the image at onece.
But in my code, Why I can not put the开发者_开发知识库 image url into the jquery.html
code?
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#insert').click(function(){
var value = $(this).val();
$("#view").html('<img src="' + value + '" />');
});//http://farm4.static.flickr.com/3642/3450584784_a1f7759fbf_s.jpg
});
</script>
<style type="text/css">
#view{width:50px;height:50px;}
</style>
</head>
<body id="body1">
<form name="form" style="float:right;padding:10px;float:left;">
<input type="text" value="" id="file" name="file">
<a name="Insert" id="insert" href="javascript:void(0)">Via</a>
</form>
<div id="view"></div>
</body>
</html>
Change var value = $(this).val();
to var value = $('#file').val();
.
精彩评论