网页经典代码(二)

8.永远都会带着框架

1<script language="javascript"><!--   
2if (window == top)top.location.href = "frames.htm";// --></script>

说明:frames.htm为你的网页,这也是保护页面的一种方法

9.防止被人frame

1<script language="javascript"><!--   
2if (top.location != self.location)top.location=self.location;   
3// --></script>

10.网页将不能被另存为

1<noscript><iframe src="*.html"></iframe></noscript>

说明:

 1<noscirpt>的用法很广,其中一条就是可以使JS广告失效。   
 2  
 311.查源文件   
 4  
 5<input onclick="window.location = 'view-source:'+ '  http://www.e3i5.com/test.htm';" type="button" value="查看网页源代码"/>   
 6  
 7  
 812.COOKIE脚本记录,有很大的用处哦   
 9  
10function get_cookie(Name) {   
11var search = Name + "="   
12  
13var returnvalue = "";   
14  
15if (documents.cookie.length &gt; 0) {   
16  
17offset = documents.cookie.indexOf(search)   
18  
19if (offset != -1) { // if cookie exists   
20  
21offset += search.length   
22  
23// set index of beginning of value   
24  
25end = documents.cookie.indexOf(";", offset);   
26  
27// set index of end of cookie value   
28  
29if (end == -1)   
30  
31end = documents.cookie.length;   
32  
33returnvalue=unescape(documents.cookie.substring(offset, end))   
34  
35}   
36  
37}   
38  
39return returnvalue;   
40  
41}   
42  
43  
44function loadpopup(){   
45  
46if (get_cookie('popped')==''){   
47  
48openpopup()   
49  
50documents.cookie="popped=yes"   
51  
52}   
53  
54}   
55  
56说明:以上是JS代码,请自己加起始符和结束符</noscirpt>
Published At
Categories with 网页设计
Tagged with
comments powered by Disqus