jquery-点击后展开并可以点击其中的链接 $(document).ready(function () { $(".question").click(function () { $(".answer").toggle(300); }); });顺便说一句:你的html代码一点也不漂亮。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 您这代码我点击div是question的时候的确dive=answer的展开了,但是我如果点击div=answer里面的链接后,div=answer的就是消失了。这不是我要的效果,我是要点击div=question后才能消失。这个html我是用dreamweaver自动创建的,不是我自己写的。谢谢您的代码,能否实现以上那个效果? 自己搞定了。可以实现我想要的效果,供大家参考。<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>FAQ</title><link href="_css/qa.css" rel="stylesheet" type="text/css" /><style type="text/css">.question {cursor: pointer;}</style><script src="_js/jquery-1.11.1.min.js"></script><script>$(document).ready(function(){ $(".answer").hide(); $(".question").click(function(){ if($(this).children(".answer").is(":visible")==false){ $(this).children(".answer").fadeIn(300); }else{ $(this).children(".answer").hide(); } }); $(".answer").click(function(){ $(this).hide(); } ); // end click}); // end ready</script></head><body class="YaHei"><div class="question" > <table width="100%" border="0" align="center" cellspacing="0"> <tr> <th height="30" align="left" nowrap="nowrap" bgcolor="#FFC423" class="cell" scope="col"> 1. 订单操作邮件(针对客户订单重新预约上门取件、取消)</th> </tr> </table><div class="answer"><table width="100%" border="0" align="center" cellspacing="0"> <tr> <td bgcolor="#CCCCCC"><a href="email/1-1.html" target="mainFrame">1.1 订单取消邮件模板</a></td> </tr></table></div></div><br /></body></html> toggle就可以切换了。不必hide和fadeIn。 奇妙的js,运行得到的不是我想要的效果,大家帮我运行试试,谢谢 关于怎么取控件的XY坐标! 一个form多个sumit按钮,如何分辨 有多个复选框,名字都一样,如何用JS判断有多少个选中的 高分请教使用javascirpt编写对象的问题。 页面拖动后怎样获得新位置(急) 关于框架网页中自做前进后退按钮出错的问题 *能不能把按回车键转换成按TAB键!????* 新手报到,下面js怎么转换成jquery的写法呢?? vuecli+elementui,tree的数据的刷新的问题 EXT嵌套表格列加入事件方法? 请问这个this的写法哪里出错了?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FAQ</title>
<link href="_css/qa.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.question {
cursor: pointer;
}
</style>
<script src="_js/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(){
$(".answer").hide();
$(".question").click(function(){
if($(this).children(".answer").is(":visible")==false){
$(this).children(".answer").fadeIn(300);
}else{
$(this).children(".answer").hide();
}
});
$(".answer").click(function(){
$(this).hide();
}
); // end click
}); // end ready
</script></head>
<body class="YaHei"><div class="question" >
<table width="100%" border="0" align="center" cellspacing="0">
<tr>
<th height="30" align="left" nowrap="nowrap" bgcolor="#FFC423" class="cell" scope="col"> 1. 订单操作邮件(针对客户订单重新预约上门取件、取消)</th>
</tr>
</table>
<div class="answer">
<table width="100%" border="0" align="center" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><a href="email/1-1.html" target="mainFrame">1.1 订单取消邮件模板</a></td>
</tr>
</table>
</div>
</div>
<br />
</body>
</html>
toggle就可以切换了。不必hide和fadeIn。