老师,请检查
来源:3-4 自由编程
慕函数4436287
2019-07-08 17:44:14
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>3-4编程练习</title> <style> #bigBox{ width: 400px; height: 400px; background: pink; } #smallBox{ width: 100px; height: 100px; background: skyblue; display: none; } </style> </head> <body> <div id="btn">点击这里</div> <div id="bigBox"> <div id="smallBox">我是smallbox里面的内容</div> </div> <script src="../lib/zepto.min.js"></script> <script> $(document).ready(function () { //js代码 $('#btn').on('click',function () { $("#smallBox").toggle() }) }) </script> </body> </html>
2回答
好帮手慕码
2019-07-08
同学你好!
测试了下,代码效果实现的是可以的
如果帮助到了你 欢迎采纳 祝学习愉快~
慕函数4436287
提问者
2019-07-08
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>3-4编程练习</title> <style> #bigBox{ width: 400px; height: 400px; background: pink; } #smallBox{ width: 100px; height: 100px; background: skyblue; display: none; } .active{ display: block; } </style> </head> <body> <div id="btn">点击这里</div> <div id="bigBox"> <div id="smallBox">我是smallbox里面的内容</div> </div> <script src="../lib/zepto.min.js"></script> <script> $(document).ready(function () { //js代码 $('#btn').on('click',function () { $('#smallBox').toggle() }); $('#smallBox').click(function () { alert('已执行') }) }) </script> </body> </html>
忘了alert
相似问题