座机式链接生成器
做的一个方便老司机收藏资源站的脚本, 像拨打座机一样,只要按下一组号码便自动链接到其他网页,可当做短链生成器,如01是AcFun.cn,02是bilibili.com,25是YouTube.com
步骤一 拷贝以下脚本后贴在有关网页的<head>与</head>之间
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var dianhua_num='';
var timerID = null;
var timerRunning = false;
function but1()
{
dianhua_num = dianhua_num + '1';
chknum();
}
function but2()
{
dianhua_num = dianhua_num + '2';
chknum();
}
function but3()
{
dianhua_num = dianhua_num + '3';
chknum();
}
function but4()
{
dianhua_num = dianhua_num + '4';
chknum();
}
function but5()
{
dianhua_num = dianhua_num + '5';
chknum();
}
function but6()
{
dianhua_num = dianhua_num + '6';
chknum();
}
function but7()
{
dianhua_num = dianhua_num + '7';
chknum();
}
function but8()
{
dianhua_num = dianhua_num + '8';
chknum();
}
function but9()
{
dianhua_num = dianhua_num + '9';
chknum();
}
function but0()
{
dianhua_num = dianhua_num + '0';
chknum();
}
function chknum()
{
//在这里设定号码与路径
if (dianhua_num=="01")
document.location="http://www.lidicity.com";
if (dianhua_num=="768")
document.location="http://www.lidicity.com/julebu/";
if (dianhua_num=="756")
document.location="http://www.lidicity.com/julebu/zhiwangle/";
if (dianhua_num=="5997")
document.location="http://www.lidicity.com/hjjq/";
if (dianhua_num=="963")
document.location="http://www.lidicity.com/msgboard.mv";
document.board.pn.value=dianhua_num;
}
function clearit()
{
dianhua_num = "";
document.board.pn.value=dianhua_num;
}
// End -->
</script>
步骤二 拷贝以下代码加在<body>与</body>标记之间,要展示它的部位
<form name="board">
<center>
<table BORDER="2" BORDERCOLOR="#000000" CELLSPACING=2 CELLPADDING=3 COLS=3 WIDTH="130" BGCOLOR="#025B75" >
<tr ALIGN=CENTER>
<td><input type=button value=" 1 "onClick="but1(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 2 "onClick="but2(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 3 "onClick="but3(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
</tr>
<tr ALIGN=CENTER>
<td><input type=button value=" 4 "onClick="but4(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 5 "onClick="but5(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 6 "onClick="but6(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
</tr>
<tr ALIGN=CENTER>
<td><input type=button value=" 7 "onClick="but7(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 8 "onClick="but8(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 9 "onClick="but9(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
</tr>
<tr ALIGN=CENTER>
<td><input type=button value=" * "onClick="clearit(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" 0 "onClick="but0(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
<td><input type=button value=" # "onClick="clearit(); window.focus()" style="background-color: rgb(217,245,252); color: rgb(2,91,117); border-left: 1px solid rgb(255,255,255); border-right: 1px solid rgb(0,0,0); border-top: 1px solid rgb(255,255,255); border-bottom: 1px solid rgb(0,0,0)"></td>
</tr>
<tr>
<td ALIGN=CENTER COLSPAN="3"><input type=text name=pn size="10" style="background-color: rgb(192,216,184); color: rgb(0,0,0); border-left: 1px solid rgb(0,0,0); border-right: 1px solid rgb(255,255,255); border-top: 1px solid rgb(0,0,0); border-bottom: 1px solid rgb(255,255,255)"></td>
</tr>
</table></center>
<center></form>
</center>
注意:先设定好数字含义才能使用,可以用它实现快速搜索