$(document).ready(function() {
$("#nameit").blur(function() {
$("#msgdiv").css({
top : $("#righttd:first").offset().top,
left : $("#righttd:first").offset().left - 40,
visibility:"visible"
})
})
$("#nameit").focus(function() {
$("#msgdiv").css({
visibility:"hidden"
})
})
})
JQ很久不用了,给你写一段纯js的吧
var left = 50var div = document.getElementById('div01')//比如有一个div的 id 为 div01
div.style.left = left + 'px'
<!DOCTYPE HTML><html>
<head>
<meta charset="UTF-8" />
<title>MODEL PAGE</title>
<style type="text/css">
table {
border: 1px solid black
border-collapse: collapse
}
td,th {
border: 1px solid black
}
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$ (function ()
{
$ (".memu .left p").click (function ()
{
var _index = $ (this).index (".memu .left p")
$ (".right:eq(" + _index + ") .selContent").toggle ()
})
})
</script>
</head>
<body>
<div class="memu">
<div class="content">
<div class="left">
<p>速递</p>
</div>
<div class="right">
<div class="selContent">11111</div>
<div class="selContent">22222</div>
</div>
</div>
</div>
<div class="memu">
<div class="content">
<div class="left">
<p>速递</p>
</div>
<div class="right">
<div class="selContent">11111</div>
<div class="selContent">22222</div>
</div>
</div>
</div>
</body>
</html>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)