javascript初级问题,菜单点击输入法,下面ul展开收缩,没有实现,该怎么做,求解析
<body><divid=shurufa><divid=sx><divid=shouxie><ahref="#">手写</a></div><divid=gif><imgs...
<body>
<div id=shurufa>
<div id=sx>
<div id=shouxie><a href="#">手写</a></div>
<div id=gif><img src="shurufa.png" width="14" height="14" /></div>
</div>
<div id=xk style="display:block";>
<ul >
<li><a href="#" >拼音</a></li>
<li><a href="#" >手写</a></li>
<li><a href="#" >关闭</a></li>
</ul></div>
</div>
<script type="text/javascript">
window.onload=function()
{
var.se=document.getElementById('sx');
var.xk1=document.getElementById('xk');
se.onload=function()
{
if(xk1.style.display=='block')
{
xk1.style.display='none';
}
else
{
xk1.style.display='block';
}
}
};
</script>
</body>
</html> 展开
<div id=shurufa>
<div id=sx>
<div id=shouxie><a href="#">手写</a></div>
<div id=gif><img src="shurufa.png" width="14" height="14" /></div>
</div>
<div id=xk style="display:block";>
<ul >
<li><a href="#" >拼音</a></li>
<li><a href="#" >手写</a></li>
<li><a href="#" >关闭</a></li>
</ul></div>
</div>
<script type="text/javascript">
window.onload=function()
{
var.se=document.getElementById('sx');
var.xk1=document.getElementById('xk');
se.onload=function()
{
if(xk1.style.display=='block')
{
xk1.style.display='none';
}
else
{
xk1.style.display='block';
}
}
};
</script>
</body>
</html> 展开
2个回答
展开全部
<body>
<div id=shurufa>
<div id=sx>
<div id=shouxie><a href="#">手写</a></div>
<div id=gif><img src="shurufa.png" width="14" height="14" /></div>
</div>
<div id=xk style="display:none">
<ul >
<li><a href="#" >拼音</a></li>
<li><a href="#" >手写</a></li>
<li><a href="#" >关闭</a></li>
</ul></div>
</div>
<script type="text/javascript">
window.onload=function()
{
var se=document.getElementById('sx');
var xk1=document.getElementById('xk');
se.onmouseover=function() {xk1.style.display='block';}
xk1.onmouseover=function() {xk1.style.display='block';}
xk1.onmouseout=function() {xk1.style.display='none';}
}
</script>
</body>
</html>
<div id=shurufa>
<div id=sx>
<div id=shouxie><a href="#">手写</a></div>
<div id=gif><img src="shurufa.png" width="14" height="14" /></div>
</div>
<div id=xk style="display:none">
<ul >
<li><a href="#" >拼音</a></li>
<li><a href="#" >手写</a></li>
<li><a href="#" >关闭</a></li>
</ul></div>
</div>
<script type="text/javascript">
window.onload=function()
{
var se=document.getElementById('sx');
var xk1=document.getElementById('xk');
se.onmouseover=function() {xk1.style.display='block';}
xk1.onmouseover=function() {xk1.style.display='block';}
xk1.onmouseout=function() {xk1.style.display='none';}
}
</script>
</body>
</html>
追问
追答
手写
拼音
手写
关闭
window.onload=function()
{
var se=document.getElementById('sx');
var xk1=document.getElementById('xk');
se.onclick=function() {
if (xk1.style.display=='none')
xk1.style.display='block';
else
xk1.style.display='none';
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询