
1. 禁止復制(copy),禁用鼠標右鍵!
<SCRIPT>
//加入頁面保護
function rf()
{return false; }
document.oncontextmenu = rf
function keydown()
{if(event.ctrlKey ==true || event.keyCode ==93 || event.shiftKey ==true){return false;} }
document.onkeydown =keydown
function drag()
{return false;}
document.ondragstart=drag
function stopmouse(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
return false;
else if
(navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert("版權沒有,但別復制 :)");
return false;
}
return true;
}
document.onmousedown=stopmouse;
if (document.layers)
window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=stopmouse;
</SCRIPT>
<script language="javascript">
function JM_cc(ob){
var obj=MM_findObj(ob); if (obj) {
obj.select();js=obj.createTextRange();js.execCommand("Copy");}
}
function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}
</script>
2. JS和HTML互轉
<body>
<style>
body{font-size:9pt}
textarea {color="#707888";font-family:"verdana"}
.inputs {color="#707888";border:1px solid;background:#f4f4f4}
</style>
在這里輸入你需要轉換的格式,可以是JavaScript也可以是DHtml.
<br>
<textarea id="codes" style="width:730;height:300">
</textarea>
<br>
<button class="inputs">
清除輸出
</button>
<button class="inputs">
全選代碼
</button>
<button class="inputs">
拷貝代碼
</button>
<button class="inputs">
粘貼代碼
</button>
<button class="inputs">
Js轉Html
</button>
<button class="inputs">
Html轉Js
</button>
<button class="inputs">
點擊顯示源文件
</button>
<button class="inputs">
預覽代碼[F12]
</button>
<br>
這個是輸出格式的窗口:
<br>
<textarea id="outputs" style="width:730;height:300"></textarea>
<br>
一個不好的消息:這個Js轉Html部分現在只是支持由這個程序生成的
<br>
作者:FlashSoft2000 QQ:14433548
<input id="hide" style='display:none'>
<script>
//定義title
document.title="多功能網頁轉換"
//顯示網頁源文件
function writes()
{
outputs.value=document.body.outerHTML;
}
//清除輸出窗口
function clears()
{
outputs.innerHTML='';
}
//替換特定字符
//n1字符串,n2要替換的字,n3替換的字
function commute(n1,n2,n3)
{
var a1,a2,a3=0,a0=''
a1=n1.length;
a2=n2.length;
for(x=0;x<=(a1-a2);x++)
{
if(n1.substr(x,a2)==n2)
{
a0+=n1.substring(a3,x);
a0+=n3;
x+=(a2-1);
a3=x+1;
}
}
if(a3<a1)a0+=n1.substring(a3,a1)
{
return a0;
}
}
//轉換JavaScript為DHtml
function js2html()
{
hide.value=codes.value
hide.value=commute(hide.value,'\\"','"');
hide.value=commute(hide.value,'document.write("','');
hide.value=commute(hide.value,'")','');
hide.value=commute(hide.value,'<script>','');
hide.value=commute(hide.value,'<\/script>','');
outputs.value=hide.value
}
//轉換DHtml為JavaScript
function html2js()
{
hide.value=codes.value
hide.value=commute(hide.value,'"','\\"');
hide.value=commute(hide.value,'\\','\\\\');
hide.value=commute(hide.value,'<\/script>','<\\/script>');
outputs.value="<script>document.write(\""+hide.value+"\")<\/script>"
}
//預覽代碼
function seeHtm()
{
open().document.write("<title>測試代碼窗口</title>"+outputs.value);
}
//用快捷鍵F12預覽
document.onkeydown=seeHtms
function seeHtms()
{
if((event.keyCode==123))
{
open().document.write("<title>測試代碼窗口</title>"+outputs.value);
}
}
//全選代碼
function ta()
{
outputs.select()
}
//拷貝代碼
function tc()
{
document.execCommand("Copy")
}
//粘貼代碼
function tp()
{
outputs.focus()
document.execCommand("Paste")
}
</script>
您發布的評論即表示同意遵守以下條款:
一、不得利用本站危害國家安全、泄露國家秘密,不得侵犯國家、社會、集體和公民的合法權益;
二、不得發布國家法律、法規明令禁止的內容;互相尊重,對自己在本站的言論和行為負責;
三、本站對您所發布內容擁有處置權。