javascript常用函数(2)(3)

<html> <head> <title>打字效果的带链接的新闻标题</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <style type="text/css"> body{font-size:14px;font-weight:bold;} </style> </head> <body> 最新内容:<a href="" target="_blank"></a> <script language="JavaScript"> var NewsTime = 2000; //每条新闻的停留时间 var TextTime = 50; //新闻标题文字出现等待时间,越小越快 var newsi = 0; var txti = 0; var txttimer; var newstimer; var newnewstitle = new Array(); //新闻标题 var newnewshref = new Array(); //新闻链接 newstitle[0] = "javascript常用函数"; newshref[0] = "https://www.jb51.net/article/74365.htm"; newstitle[1] = "https://www.jb51.net/"; newshref[1] = "https://www.jb51.net/"; function shownew() { var endstr = "_"; hwnewstr = newstitle[newsi]; newslink = newshref[newsi]; if(txti==(hwnewstr.length-1)){endstr="";} if(txti>=hwnewstr.length){ clearInterval(txttimer); clearInterval(newstimer); newsi++; if(newsi>=newstitle.length){ newsi = 0 } newstimer = setInterval("shownew()",NewsTime); txti = 0; return; } clearInterval(txttimer); document.getElementById("HotNews").href=newslink; document.getElementById("HotNews").innerHTML = hwnewstr.substring(0,txti+1)+endstr; txti++; txttimer = setInterval("shownew()",TextTime); } shownew(); </script> </body> </html>

22、简单打印

<style type="text/css" media=print> .noprint{display : none } </style> <input type="button" value="打印" /><br> 这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,<br> 这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,<br> 这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,这里是被打印的地方,<br> <p>这里是不需要打印的地方</p>

23、禁止右键

<html> <title>jquery 禁止右键</title> <head> <script src="https://www.jb51.net/jquery.js"></script> <script type="text/javascript"> $(function(){ $(document).bind("contextmenu",function(e){ return false; }); }); </script> <body> Xinjiang to implement amended public security measures to safeguard social stability Xinjiang to implement amended public security measures to safeguard social stability Xinjiang to implement amended public security measures to safeguard social stability Xinjiang to implement amended public security measures to safeguard social stability Xinjiang to implement amended public security measures to safeguard social stability Xinjiang to implement amended public security measures to safeguard social stability </body> </html>

24、防止垃圾邮件

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgzxss.html