?? public.js
字號(hào):
//get an object by the id
function findObject(id, doc) {//from macromedia
var p,i,x;
if(!doc) doc=document;
if((p=id.indexOf("?"))>0&&parent.frames.length) {
doc=parent.frames[id.substring(p+1)].document;
id=id.substring(0,p);
}
if(!(x=doc[id])&&doc.all) x=doc.all[id];
for (i=0;!x&&i<doc.forms.length;i++)
x=doc.forms[i][id];
for(i=0;!x&&doc.layers&&i<doc.layers.length;i++)
x=findObj(id,doc.layers[i].document);
if(!x && doc.getElementById)
x=doc.getElementById(id);
return x;
}
//get an object list by a same name
function findObjectListByName(name, doc){
var list;
if(!doc) doc = document;
if(!doc.all){
list = doc.getElementsByName(name);
}
else{
list = new Array();
var count = 0;
for(var i = 0; i < doc.all.length; i++){
var element = doc.all[i];
if(element.name == name){
list[count] = element;
count++;
}
}
}
return list;
}
//get an object list by a same tag name
function findObjectListByTag(name, doc){
var list;
if(!doc) doc = document;
if(doc.all){
list = doc.all.tags(name);
}
else{
list = doc.getElementsByTagName(name);
}
return list;
}
/**
open a modal dialog window
*/
function openModal(url, width, height){
var sFeatures = "dialogWidth:"+ width + "px;dialogHeight: " + height + "px;scroll:no";
return window.showModalDialog(url, "", sFeatures);
}
/**
open a popup window
usage:
openWindow("page.html", "newwindow", 200, 300,
"toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no");
*/
function openWindow(url, windowID, height, width, otherParam){
var param = "";
//height and top
if(height == null || isNaN(height) || height <= 0){
param += "height=, top=,";
}
else{
var top = (screen.availHeight - height) / 2;
param += "height=" + height + ", top=" + top + ",";
}
//width and left
if(width == null || isNaN(width) || width <= 0){
param += "width=, left=,";
}
else{
var left = (screen.availWidth - width) / 2;
param += "width=" + width + ", left=" + left + ",";
}
if(otherParam == null || otherParam == ""){
otherParam = "toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no";
}
window.open(url, windowID, param + otherParam);
}
//Make a string as a tag
function markTag(str){
return "<" + str + ">"
}
//show a debug message
function debug(msg){
if(isDebug)
alert("==DEBUG==\n" + msg);
}
//show a error message
function err(msg){
alert("!!ERROR!!\n" + msg);
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -