網頁
思路:
在html.asp中用<script src="js.asp"></script>方式來顯示內容,在html.asp代碼中,設定一個session,在js.asp進行判斷,如果是設定的值就顯示正常內容,如果不是,就隱藏或顯示其它內容,在js.asp的結尾把session值改變,在html.asp和js.asp中都加一段代碼,使得遊覽器不快取頁面面只能做到簡單的隱藏,使用工具軟體可以看到源檔案,範例程式碼:
html.asp程式碼:
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>查看代碼 - www.51windows.Net</title>
<style>
<!--
td { font-family: Tahoma; font-size: 8pt; color: #000080; line-height: 150%;
border: 1 solid #666666; padding: 4 }
-->
</style>
</head>
<body>
<%
session("haiwa") = "hw"
%>
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" width="480">
<tr>
<td id="tmp"><SCRIPT LANGUAGE="JavaScript" src="js.asp" id="js"></SCRIPT></td>
</tr>
</table>
</center>
</div>
</body>
</html>
js.asp程式碼:
<%
Response.Expires = 0
Response.Expiresabsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
if session("haiwa") <> "hw" then
response.write "//歡迎查看源檔案"
response.end
end if
%>
//高,這你都能看得出來。我沒有招了。。哈哈
document.write (" 先做後想,先想後做,邊想邊做;只想不做,只做不想,不想不做。------世界是幾乎都被這六種人涵蓋了,如果作為個人能清楚的分析並看出自己屬於哪一類人,至少證明你自己是個聰明人。")
<%
session("haiwa") = ""
%>