.show不出來
<!DOCTYPE html>
<html>
<head>
<title>Milky Way</title>
<style type="text/css">
body{background-image:url(1.jpg)}
.ss{bottom: 150px;right: 345px;position: absolute;width: 1400px;height: 1000px; z-index:0;}
.aa{position: relative;top:500px;left:530px;z-index:1;float: left;border: 0;width: 800px;height: 40px;line-height: 40px;}
.bb{position: relative;top:507px;left:500px;z-index:1;float: left;border: 0;background-image: url(3.png);width: 25px;height: 25px;cursor:pointer;}
.lln{width: 800px;background-color: #fff;border: 1px solid #999;}
.lln ul{list-style: none;margin: 0;padding: 0;}
.lln ul li{padding: 3px;font-size: 14px;line-height: 25px; cursor:pointer; }
.lln ul li:hover{text-decoration: underline;background-color: #e5e5e5;}
</style>
</head>
<body>
<form class="dx" id="dx" action="http://www.baidu.com/s" target="_blank" >
<input type="text" class="aa" id="ln" name=word size=40 ?
?>
<input type="submit" class="bb" value="" >
</form>
<img class="ss" src="2.png">
<div class="lln" id="lln" style="display:none;">
<ul>
<li>搜索結(jié)果1</li>
<li>搜索結(jié)果2</li>
</ul>
</div>
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script >
$('#ln').bind('keyup',funtion(){
$('#lln').show().css({
top:$('#dx').offset().top+$('#dx').height()+10,
left:${'#dx'}.offset().left,
position:'absolute';
})
};
</script>
</body>
</html>
2016-06-01
function 寫錯了 ;也用錯了地方 ?還有標點是全角。 多看看日志就行了
? ? ? ? $("#lin").bind('keyup', function () {
? ? ? ? ? ? $('#lln').show().css({
? ? ? ? ? ? ? ? top: $('#dx').offset().top + $('#dx').height() + 10,
? ? ? ? ? ? ? ? left: $('#dx').offset().left,
? ? ? ? ? ? ? ? position: 'absolute'
? ? ? ? ? ? });
? ? ? ? })
自己對照吧
2016-06-02
細節(jié),注意左右括號的閉合,最后少了個右括號
$('#ln').bind('keyup',funtion(){
$('#lln').show().css({
top:$('#dx').offset().top+$('#dx').height()+10,
left:${'#dx'}.offset().left,
position:'absolute'
})
});