天天看點

網頁制作常用代碼

我們已經禁了右鍵,但從"檢視"菜單下的"源檔案"中同樣可以看到源代碼,下面我們就來解決這個問題:

其實這隻要使用一個含有<frame></frame>标記的網頁便可以達到目的。

<frameset>

<frame src="你要保密的檔案的URL">

</frameset>

這樣當有人使用"檢視"下的"源檔案"的時候,看到的将是上面的那段代碼,而你真正的檔案又躲過一劫。

禁示另存為

通過上面的兩步好像你的源代碼已經安全了,但别忘了,别人還可以将你的頁面儲存下來,再慢慢分析。不過别擔心,下面我們來解決這個問題。

在你要保密的網頁中加入以下代碼:

<noscript><iframe src="*.htm"></iframe></noscript>

徹底屏蔽右鍵方法。

<body oncontextmenu="return false">

輕按兩下頁面後自動滾屏,單擊後停止。

<SCRIPT language=javascript>

var currentpos,timer;

function initialize()

{ timer=setInterval("scrollwindow()",16); }

function sc(){

clearInterval(timer);

}

function scrollwindow()

{currentpos=document.body.scrollTop;

window.scroll(0,++currentpos);

if (currentpos != document.body.scrollTop)

sc();

document.onmousedown=sc

document.ondblclick=initialize

</script>

設定腳本出錯能繼續運作

<script language="javascript">

function KillError()

{

return false;

window.onerror=KillError;

将徹底屏蔽滑鼠右鍵

oncontextmenu="window.event.returnvalue=false"

可用于Table

<table border oncontextmenu=return(false)><td>no</table>

取消選取、防止複制

<body onselectstart="return false">

不準粘貼

onpaste="return false"

防止複制

oncopy="return false;" oncut="return false;"

IE位址欄前換成自己的圖示

<link rel="Shortcut Icon" href="favicon.ico">

可以在收藏夾中顯示出你的圖示

<link rel="Bookmark" href="favicon.ico">

關閉輸入法

<input style="ime-mode:disabled">

永遠都會帶着架構

<script language="javascript"><!--

if (window == top)top.location.href = "frames.htm";

//frames.htm為架構網頁

// -->

防止被人frame

<SCRIPT LANGUAGE=javascript><!--

if (top.location != self.location)

top.location=self.location;

</SCRIPT>

怎樣通過asp的手段來檢查來訪者是否用了代理

<% if Request.ServerVariables("HTTP_X_FORWARDED_FOR")<>"" then

response.write "<font color=#FF0000>您通過了代理伺服器," & "真實的IP為 "&Request.ServerVariables("HTTP_X_FORWARDED_FOR")

end if

%>

取得控件的絕對位置

//javascript

function getIE(e){

var t=e.offsetTop;

var l=e.offsetLeft;

while(e=e.offsetParent){

t+=e.offsetTop;

l+=e.offsetLeft;

alert("top="+t+"nleft="+l);

//VBScript

<script language="VBScript">

<!--

function getIE()

dim t,l,a,b

set a=document.all.img1

t=document.all.img1.offsetTop

l=document.all.img1.offsetLeft

while a.tagName<>"BODY"

set a = a.offsetParent

t=t+a.offsetTop

l=l+a.offsetLeft

wend

msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"

end function

-->

光标是停在文本框文字的最後

function cc()

var e = event.srcElement;

var r =e.createTextRange();

r.moveStart('character',e.value.length);

r.collapse(true);

r.select();

<input type=text name=text1 value="123" onfocus="cc()">

判斷上一頁的來源

asp:

request.servervariables("HTTP_REFERER")

javascript:

document.referrer

最小化、最大化、關閉視窗 按鈕

<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">

<param name="Command" value="Minimize"></object>

<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">

<param name="Command" value="Maximize"></object>

<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<ARAM NAME="Command" value="Close"></OBJECT>

<input type=button value=最小化 onclick=hh1.Click()>

<input type=button value=最大化 onclick=hh2.Click()>

<input type=button value=關閉 onclick=hh3.Click()>

本例适用于IE

記錄并顯示網頁的最後修改時間

<script language=javascript>

document.write("最後更新時間: " + document.lastModified + "")

2秒後關閉目前頁

setTimeout('window.close();',2000);

2秒後載入指定網頁

<head>

<meta http-equiv="refresh" content="2;URL=http://你的網址">

</head>

添加到收藏夾

<Script Language="javascript">

function bookmarkit()

 window.external.addFavorite('http://你的網址','你的網站名稱')

 if (document.all)document.write('<a href="#" onClick="bookmarkit()">加入收藏夾</a>')

</Script>

禁止滑鼠右鍵的動作

<Script Language = "javascript">

function click() { if (event.button==2||event.button==3)

 alert('禁止滑鼠右鍵');

document. // -->

function click() { if (event.button==2)

{alert('*^_^*'); } } document. // -->

設定該頁為首頁

<body bgcolor="#FFFFFF" text="#000000">

<a class="chlnk" style="cursor:hand" HREF onClick="this.style.behavior='url(#default#homepage)'; this.setHomePage('你的網站名稱);"><font color="000000" size="2" face="宋體">設為首頁</font></a>

</body>

節日倒計時

  var timedate= new Date("October 1,2002");

  var times="國慶節";

  var now = new Date();

  var date = timedate.getTime() - now.getTime();

  var time = Math.floor(date / (1000 * 60 * 60 * 24));

  if (time >= 0)

  document.write("現在離"+times+"還有: "+time +"天")

單擊按鈕列印出目前頁

  if (window.print) {

  document.write('<form>'

  + '<input type=button name=print value="列印本頁" '

  + 'onClick="javascript:window.print()"></form>');

  }

單擊按鈕‘另存為’目前頁

<input type="button" name="Button" value="儲存本頁" onClick="document.all.button.ExecWB(4,1)">

<object id="button" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">

<embed width="0" height="0"></embed>

</object>

顯示系統目前日期

  today=new Date();

  function date(){

  this.length=date.arguments.length

  for(var i=0;i<this.length;i++)

  this[i+1]=date.arguments }

  var d=new date("星期日","星期一","星期二","星期三","星期四","星期五","星期六");

  document.write(

  "<font color=##000000 style='font-size:9pt;font-family: 宋體'> ",

  today.getYear(),"年",today.getMonth()+1,"月",today.getDate(),"日",

  d[today.getDay()+1],"</font>" );

不同時間段顯示不同問候語 <Script Language="javascript">

var text=""; day = new Date( ); time = day.getHours( );

  if (( time>=0) && (time < 7 ))

    text="夜貓子,要注意身體哦! "

  if (( time >= 7 ) && (time < 12))

    text="今天的陽光真燦爛啊,你那個朋友呢?"

  if (( time >= 12) && (time < 14))

    text="午休時間。您要保持睡眠哦!"

  if (( time >=14) && (time < 18))

    text="祝您下午工作愉快! "

  if ((time >= 18) && (time <= 22))

    text="您又來了,可别和MM聊太久哦!"

  if ((time >= 22) && (time < 24))

    text="您應該休息了!"

  document.write(text)

水中倒影效果 <img id="reflect" src="你自己的圖檔檔案名" width="175" height="59">

  <script language="javascript">

  function f1()

  {

    setInterval("mdiv.filters.wave.phase+=10",100);

  if (document.all)

    document.write('<img id=mdiv src="'+document.all.reflect.src+'"

    style="filter:wave(strength=3,freq=3,phase=0,lightstrength=30) blur() flipv()">')

    window.onload=f1

慢慢變大的視窗 <Script Language="javascript">

  <!--

  var Windowsheight=100

  var Windowswidth=100

  var numx=5

  function openwindow(thelocation){

  temploc=thelocation&, amp;, nbsp;

  if

  (!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById))

    window.open(thelocation)

    return

  windowsize=window.open("","","scrollbars")

  windowsize.moveTo(0,0)

  windowsize.resizeTo(100,100)

  tenumxt()

  function tenumxt(){

  if (Windowsheight>=screen.availHeight-3)

    numx=0

  windowsize.resizeBy(5,numx)

  Windowsheight+=5

  Windowswidth+=5

  if (Windowswidth>=screen.width-5)

    windowsize.location=temploc

    Windowsheight=100

    Windowswidth=100

    numx=5

  setTimeout("tenumxt()",50)

  //-->

<a href="javascriptpenwindow('http://ycff.com/ycff')">進入</a>

滑鼠指向時彈出資訊框

在<body></body>之間加上如下代碼: <a href onmouseover="alert('彈出資訊!')">顯示的連結文字</a>

随機變換背景圖象(一個可以重新整理心情的特效)

在<head></head>之間加上如下代碼:

  p_w_picpath = new Array(4); //定義p_w_picpath為圖檔數量的數組

  p_w_picpath [0] = 'tu0.gif' //背景圖象的路徑

  p_w_picpath [1] = 'tu1.gif'

  p_w_picpath [2] = 'tu2.gif'

  p_w_picpath [3] = 'tu3.gif'

  p_w_picpath [4] = 'tu4.gif'

  number = Math.floor(Math.random() * p_w_picpath.length);

  document.write("<BODY BACKGROUND="+p_w_picpath[number]+">");

滑鼠一碰就給顔色看的連結在<body></body>之間加上如下代碼:

<p onMouseMove="anniu()">你敢碰我,我就給點顔色你看!</p>

<Script Language = "VBScript">

  sub anniu

  document.fgColor=int(256*256*256*rnd)

  end sub

從天而降并有幻影效果的視窗

  <head>

  <Script language="javascript">

  function move(x) {

  if(self.moveBy){

  self.moveBy (0,-800);

  for(i = x; i > 0; i--)

  self.moveBy(0,3);

  for(j = 200; j > 0; j--){ //如果你認為視窗抖動厲害,就200換成個位數

  self.moveBy(0,j);

  self.moveBy(j,0);

  self.moveBy(0,-j);

  self.moveBy(-j,0);

  </Scrip>

  <body bgColor=#ffffff onload=move(280)>

  </body>

  </head>

表格的半透明顯示效果在<head></head>之間加上如下代碼:

<style>

.alpha{filter: Alpha(Opacity=50)} //50表示50%的透明度

</style>

在<body></body>之間加上如下代碼:

<table border="1" width="100" height="62" class="alpha" bgcolor="#F2A664" >

 <tr>

  <td width="100%" height="62">

  <div align="center">很酷吧!</div>

  </td>

 </tr>

</table>

鎖定狀态欄文字防止顯示位址

<body onmouseover="self.status='文字';return true">

禁止圖檔下載下傳

在<body......>這裡的最後加入:

oncontextmenu="return false" ondragstart="return false" onselectstart="return false" scroll="auto"

禁止緩存

<meta http-equiv="Expires" CONTENT="0">

<meta http-equiv="Cache-Control" CONTENT="no-cache">

<meta http-equiv="ragma" CONTENT="no-cache">

加在HEAD裡

使用包含頁面

加密所包含頁面位址,使用工具 htmlguardian5.3.5

目前功能最強的html代碼加密軟體,可以保護連接配接和html代碼被盜。1.鎖右鍵。2.禁滑鼠圈選。3.不允許離線使用。4.密碼保護。5.不顯示狀态欄url位址。6.全代碼或 局部代碼保護。7.連結跟蹤。8.禁止列印(IE5+)。9.壓縮代碼( 未加密前)。10.可加密*.html *.js *.asp *.vbs。11.兩種不同加密算法。12.加密 frameset 結構。13.某些功能支援幾個不同版本的浏覽器。

 

下載下傳flash我的三種方法:

--檢視源檔案,找出flash的絕對路徑,複制,在flashget(或螞蟻)中點任務

,然後點建立下載下傳任務即可。

--在IE的臨時檔案夾Temporary Internet Files裡把所有的東西都删掉,然後

重新整理你想要下載下傳flash的網頁,即可得到你所要的flash

--使用外部軟體,推薦使用Flash Catcher,安裝後隻需在你所要下載下傳的flash上右鍵,save即可。

讓IFRAME架構内的文檔的背景透明

<iframe src="about:<body style='background:transparent'>" allowtransparency></iframe>

進入頁面後立即自動重新整理?

<meta http-equiv="refresh" content="120;url=http://lanfengyue.blog.51cto.com/">

,http://lanfengyue.blog.51cto.com/這是你自己的網址。

打開視窗即最大化(1)

<!-- Begin

self.moveTo(0,0)

self.resizeTo(screen.availWidth,screen.availHeight)

// End -->

打開視窗即最大化(2)

<!-- 最大化 -->

<object id=maximize type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">

<param name="Command" value="MAXIMIZE">

if(self.screenLeft>1){

maximize.Click();

self.focus();

能隐藏IFRAME的滾動條嗎?我知道的三種方法:

1. 設定iframe scrolling="no"

2. 被包含頁body應用overflow:hidden

3. 被包含頁的body标簽加scroll="no"

加入背景音樂

<bgsound src="mid/windblue[1].mid" loop="-1"> 隻适用于IE

<embed src="music.mid" auto_old="true" loop="true" hidden="true">

對Netscape ,IE 都适用

嵌入網頁

<iframe name="tt" src="01a.html" width="450" height="287" scrolling="Auto" frameborder="0"></iframe>

跳轉

<meta http-equiv="refresh" content="3;URL=list.htm">

滾動

<MARQUEE direction=up height=146 scrollAmount=4>

</marquee>

細線分隔線

<hr noshade size=0 color=#C0C0C0>

過度方式

<meta http-equiv="age-Exit" content="revealTrans(Duration=3,Transition=5)">

Duration的值為網頁動态過渡的時間,機關為秒。

Transition是過渡方式,它的值為0到23,分别對應24種過渡方式。如下表:

0 盒狀收縮 1 盒狀放射

2 圓形收縮 3 圓形放射

4 由下往上 5 由上往下

6 從左至右 7 從右至左

8 垂直百葉窗 9 水準百葉窗

10 水準格狀百葉窗 11垂直格狀百葉窗

12 随意溶解 13從左右兩端向中間展開

14從中間向左右兩端展開 15從上下兩端向中間展開

16從中間向上下兩端展開 17 從右上角向左下角展開

18 從右下角向左上角展開 19 從左上角向右下角展開

20 從左下角向右上角展開 21 水準線狀展開

22 垂直線狀展開 23 随機産生一種過渡方式

如何控制橫向和縱向滾動條的顯隐?

<body style="overflow-y:hidden"> 去掉x軸

<body style="overflow-x:hidden"> 去掉y軸

<body scroll="no">不顯

定義本網頁關鍵字,可以在<Head></Head>中加入如下代碼: <meta name="Keywords" content="china,enterprise,business,net">   

Content 中所包含的就是關鍵字,你可以自行設定。   

這裡有個技巧,你可以重複某一個單詞,這樣可以提高自己網站的排行位置,如:

<meta name="Keywords" content="china,china,china,china">

IE5.0 的部分快捷鍵:

A:打開查找功能:Ctrl+F

關閉浏覽器視窗:Ctrl+W

打開位址欄下拉清單框:F4

刷 新:F5

将目前Web頁儲存到收藏夾清單:Ctrl+D

打開目前 IE 視窗的一個拷貝:Ctrl+N

停止下載下傳目前網頁:Esc

光标迅速移動到網頁的開頭:Home

光标迅速移動到網頁的尾部:End

打開新的位址鍵入視窗:Ctrl+O

打開收藏夾:Ctrl+I

打開曆史記錄檔案夾:Ctrl+H

打開浏覽器設定的預設首頁:Alt+HOME

繼續閱讀