<!doctype html> <html> <head> <meta charset="utf-8" /> <title></title> <style> .w{} </style> </head> <script type="text/javascript" src="js/jquery.min.js" ></script> <body> 1. 弹窗 <script> $(function(){ alert("jq超简") }) </script> 2. 修改文本 <div>张山</div> <script> $(function(){ $("div").html("李四") }) </script> 3. 点击事件 <button id="btn">点我</button> <script> $(function(){ $("#btn").click(function(){ $("#btn").html("修改成功") }); }); </script> 4.图片显示/隐藏 (自建效果) <img src="img/bootstrap-mdo-sfmoma-01.jpg" id="img" width="200px"> <br /> <button id="btn1">显示</button><button id="btn2">隐藏</button> <a href="#" id="btn1">显示</a><a href="#" id="btn2">隐藏</a> <script> $(function(){ $("#btn1").click(function(){ $("#img").show(2000); $("#img").fadeout(2000);//渐出 $("#img").slidedown(2000);//向下出 }); }); $(function(){ $("#btn2").click(function(){ $("#img").hide(2000); $("#img").fadein(2000);//渐入 $("#img").slideup(2000);//下上藏 }) }) 自建效果 $(function(){ $("#btn1").click(function(){ $("#img").animate({ width: "400px", opacity:"0.1" , },3000) }) }) </script> 5.ad广告。定时弹出。 <img src="img/bootstrap-mdo-sfmoma-01.jpg" id="img" /> <script> $(function(){ settimeout("hidead()",3000); }); function showad(){ $("#img").show(); } function hidead(){ $("#img").hide(); settimeout("showad()",3000); } </script> </body> </html>
如对本文有疑问, 点击进行留言回复!!
20200716——gitlab实操记录/精通git阅读笔记/prop
JQuery DataTables根据行数据不同而行或列的更改颜色
VScode中的react自动补全标签代码及黄色or红色警告
关于React处理input的方法和多个input共用一个方法(不用jQuery)
网友评论