[]

Jquery hk.
arkadaşlar bir türlü beceremedim, örneğini de bulamadım internette. şöyle bir şey yapmak istiyorum. textboxa herhangi bir görsel url si girildiğinde bunu otomatik olarak <img src="" /> kısmına atayacak ve ekranda gösterecek. bir şeyler yapmaya çalıştım ama yapabildiğim textboxa girilen adresin img src ye aktarılması için textboxa bir kez daha tıklanması gerekiyor. yolu yordamı nedir bunun acaba? hazırladığım kod şöyle;
<html xmlns="www.w3.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascript' src='code.jquery.com></script>
<script>
$(document).ready(function(){
$("#resimsec").click(function(){
var src=$("#resimsec").val();
$("#gresim").attr("src",src);
});
});
</script>
<style>
#resimsec{padding:3px;}
#resimalan{padding:5px;border:1px solid #ddd;margin:20px 0 0 0;width:300px;height:250px;}
#gresim{width:100%;height:100%;}
</style>
</head>
<body>
<input type="text" name="textfield" id="resimsec" value="" />
<div id="resimalan">
<img src="" alt="" id="gresim" />
</div>
</body>
</html>
<html xmlns="www.w3.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type='text/javascript' src='code.jquery.com></script>
<script>
$(document).ready(function(){
$("#resimsec").click(function(){
var src=$("#resimsec").val();
$("#gresim").attr("src",src);
});
});
</script>
<style>
#resimsec{padding:3px;}
#resimalan{padding:5px;border:1px solid #ddd;margin:20px 0 0 0;width:300px;height:250px;}
#gresim{width:100%;height:100%;}
</style>
</head>
<body>
<input type="text" name="textfield" id="resimsec" value="" />
<div id="resimalan">
<img src="" alt="" id="gresim" />
</div>
</body>
</html>

change yerine keydown function icine de alabilirsin, change galiba input'tan focus kaybolunca calisiyor
- hjarteblod
(11.04.15 18:10:12)
1