請問如何去掉主頁右面的滾動條?
<body scroll="no">
<body style="overflow-y:hidden">
********************************
怎樣不使用頁面的緩存?即每一次打開頁面時不是調用緩存中的東西
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
********************************
請問如何忽視右鍵?
<body oncontextmenu="return false">
********************************
怎樣在同一頁面內控制不同鏈接的CSS屬性?
a:active{}
a:link{}
a:visited{}
a.1:active{}
a.1:link{}
a.1:visited{}
在DW的CSS中定義一個新的標示,按照HTML的語法,超級連接得是
A.YOURS:LINK A.YOURS:HOVER
YOURS可以改作你自己的字
然后在選中某個連接后,在CSS面版中點中YOURS即可。
按需要,你可以定義N個標示,N種鼠標OVER的效果
********************************
電子郵件處理提交表單
<form name="form1" method="post" action="mailto:webmaster@jb51.net" enctype="text/plain">
<input type=submit>
</form>
********************************
有沒有可能用層來遮住FLASH?
1.在flash的parameters里加入 <param name="wmode" value="transparent">
2.<body onblur=self.focus()>
********************************
如何根據屏幕分辨率調用相對應的頁面?
onclick=alert("你的顯示分辯率為:" screen.width "×" screen.height)
先做好幾個頁面,比如一個htm1.htm是800*600,一個是htm2.htm是1024*768的
然后在你的入口頁面 index.htm 中判斷:
<html>
<head>
<script language=javascript>
<!--
function mHref() {
if (screen.width == 1024) location.href = "htm2.htm";
else if (screen.width == 800) location.href = "htm1.htm";
else return(false);
}
//-->
</script>
</head>
<body onload="mHref();">
</body>
</html>
********************************
如何彈出只有狀態欄的窗口?
<html>
<head>
<title>open() close()</title>
<script language="javascript" type="text/javascript">
<!--
function openWin()
{
var newWin=open("","","menubar=1,height=200");
newWin.document.write("<form>");
newWin.document.write("單擊以下按鈕關閉窗口:<p>");
newWin.document.write("<input type=button value='關閉' onclick=window.close()>");
newWin.document.write("</form>");
}
</script></head>
<body>
<div align=center>
<h2>單擊以下按鈕顯示新窗口...</h2>
<form name=form1>
<input type=button value="新窗口1[只顯示地址欄]" onclick=window.open('','new1','location=1')>
<input type=button value="新窗口2[只顯示狀態欄]" onclick=window.open('','','status=1')>
<input type=button value="新窗口3[只顯示工具欄]" onclick=window.open('','new2','toolbar=1,height=200,width=450')>
<input type=button value="新窗口4[只顯示菜單欄]" onclick=openWin()>
<input type=button value="新窗口5[一個不少]" onclick=window.open('','new5')>
<input type=button value="新窗口6[光棍但可調大小]" onclick=window.open('http://www.jb51.net/forumdisplay.php?forumid=32#thread','new6','resizable=1')>
</form>
</div>
</body>
</html>
********************************
如何讓超鏈接沒有下劃線
在源代碼中的<HEAD>…</HEAD>之間輸入如下代碼:
<style type="text/css"> <!--
a { text-decoration: none}
--> </style>
********************************
請問如何做到讓一個網頁自動關閉.
<html>
<head>
<OBJECT id=closes type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<param name="Command" value="Close">
</object>
</head>
<body onload="window.setTimeout('closes.Click()',10000)">
這個窗口會在10秒過后自動關閉,而且不會出現提示. </body>
********************************
如何幾秒后轉到別的頁面?
代碼片段如下:
<META HTTP-EQUIV="Refresh" CONTENT="10;URL=http://www.jb51.net">
十秒中后跳到jb51.net的首頁
********************************
怎樣才能把RealPlayer文件在網頁做一個試聽連接?
<embed height=25 src=51js.rm type=audio/x-pn-realaudio-plugin width=50 autostart="false" controls="PlayButton">
********************************
請問如何去掉IE的上下滾動條?
<body style='overflow:scroll;overflow-y:hidden'>
</body>
********************************
解釋一下event.X和event.clientX有什么區別?
event.clientX返回事件發生時,mouse相對于客戶窗口的X坐標
event.X也一樣
但是如果設置事件對象的定位屬性值為relative
event.clientX不變
而event.X返回事件對象的相對于本體的坐標
event對象詳解 ICOOE 2000.3.31 http://www.jb51.net/
event代表事件的狀態,例如事件發生的的元素、鼠標的位置等等,event對象只在事件過程中才有效。
event屬性:
altKey
檢索ALT鍵的當前狀態
可能的值 true為關閉
false為不關閉
button
檢索按下的鼠標鍵
可能的值: 0 沒按鍵
1 按左鍵
2 按右鍵
3 按左右鍵
4 按中間鍵
5 按左鍵和中間鍵
6 按右鍵和中間鍵
7 按所有的鍵
cancelBubble
設置或檢索當前事件是否將事件句柄起泡
可能的值: false 啟用起泡
true 取消該事件起泡
clientX
檢索與窗口客戶區域有關的鼠標光標的X坐標,屬性為只讀,沒有默認值。
clientY
檢索與窗口客戶區域有關的鼠標光標的Y坐標,屬性為只讀,沒有默認值。
ctrlKey
ctrlKey 檢索CTRL鍵的當前狀態
可能的值 true為關閉
false為不關閉
dataFld
檢索被oncellchange事伯影響的列
aTransfer
為拖放操作提供預先定義的剪貼板式。
Element
檢索在onmouseover和onmouseout事件期間退出的對象指針
keyCode
設置或檢索與引發事件的關鍵字相關聯的Unicode關鍵字代碼
該屬性與onkeydown onkeyup onkeypress一起使用
如果沒有引發事件的關鍵字,則該值為0
offsetX
檢索與觸發事件的對象相關的鼠標位置的水平坐標
offsetY
檢索與觸發事件的對象相關的鼠標位置的垂直坐標
propertyName
檢索在對象上己更改的特性的名稱
reason
檢索數據源對象數據傳輸的結果
可能的值:
0 數據傳輸成功
1 數據傳輸失敗
2 數據傳輸錯誤
recordset
檢索數據源對象中默認記錄集的引用
該特性為只讀
repeat
檢索一個事件是否被重復
該屬性只有在onkeydown事件重復時才返回true
returnValue
設置或檢索從事件中返回的值
可能的值:
true 事件中的值被返回
false 源對象上事件的默認操作被取消
screenX
檢索與用戶屏相關的鼠標的水平位置
screenY
檢索與用戶屏相關的鼠標的垂直位置
shiftKey
檢索shiftKey鍵的當前狀態
可能的值 true為關閉
false為不關閉
srcElement
檢索觸發事件的對象
srcFilter
檢索導致onfilterchange事件觸發的過濾器對象
srcUm
檢索觸發事件行為的同一資源名稱
除非下面兩個條件都為真,否則該特性被設置為null
1.行為被附加到觸發事件的要素上
2.在前面的項目符號中定義的行為己指定了一個URN標識符和己觸發的事件
toElement
檢索作為onmouseover或者onmouseout事件結果而移動的對象
type
檢索事件對象中的事件名稱
x
檢索相對于父要素鼠標水平坐標的整數
y
檢索相對于父要素鼠標垂直坐標的整數
********************************************
如何讓一個窗口永遠在最上面?
<a onclick=aa()>點這里</a>
<script language='javascript'>
function aa(){
y=window.showModalDialog("http://www.jb51.net","","Height: 300; Width: 275; help: no");
}
</script>
********************************************
target="_blank"規定鏈接在新窗口中打開,那 target="_parent"、 target="_self" 、target="_top"的作用又是什么?
target="_parent"、上一層框架
target="_self" 、自身窗口、框架
target="_top" 最頂層框架。
更細點的解釋,從網上找來的:
_blank
開啟一個新的視窗,而且是沒有命名的視窗。
_self
強迫連結的結果顯示在同一個子畫面,而忽略 BASE 的設定。
_parent
在該子畫面的「父畫面」(也就是上一層的 FRAMESET)中顯示連結的結果。
_top
從視窗的最上頭開始顯示畫面;換句話說就是先清除整個視窗後再載入連結。
********************************************
如何使網友收藏本網時,收藏夾顯示的不是微軟的那個一成不變的標志,而是本人選擇的ICON?
<LINK href="fav.ico" rel="shortcut icon">
加入HADE標簽中,圖片放入根目錄下,須是.ico格式.
有的空間不支援直接放在根目錄
必須加上
<LINK href="路徑/圖檔.ico" rel="shortcut icon">
********************************************
如何監聽一個窗口被關閉了?
<body onunload="alert('你關閉了這個窗口')">
********************************************
什么是innerHTML、outerHTML………還有innerText?
<div id=test><table><tr><td>文本<a>鏈接</a>另一段文本</td></tr></table></div>
<input type=button onclick=alert(test.innerText) value="show innerText"><br>
<input type=button onclick=alert(test.innerHTML) value="show innerHTML"><br>
<input type=button onclick=alert(test.outerHTML) value="show outerHTML"><br>
********************************************
window方法列表!
發現經常有人問一些有關窗口操作的問題,
所以花了些時間整理出這篇文章,
希望以后不會再有人問這方面的問題。
ie里window的method列表
alert(sMsg)
//彈出一個確認消息框
attachEvent(sEvent,pFunction)
//綁定一個函數到某個事件,事件觸發時隨機執行其中一個被綁定的函數
blur()
//令窗口喪失焦點
clearInterval(iIntervalID)
//清除指定定時器的關聯函數
clearTimeout(iTimeoutID)
//清除指定延時器的關聯函數
close()
//關閉窗口,如果窗口不是用腳本打開的,會彈出確認對話框。
confirm([sMessage])
//彈出“確定/取消”對話框
createPopup([vArgs])
//創建一個隱藏的彈出式窗口,vArgs是未來考慮提供的參數,返回窗口句柄
detachEvent(sEvent,pFunction)
//取消一個事件的某個綁定函數
execScript(sExpression, sLanguage)
//用指定的語言執行代碼
focus()
//激活窗口
moveBy(iX,iY)
//用相對方式移動窗口
moveTo(iLeft,iTop)
//用絕對方式移動窗口
navigate(sURL)
//轉到指定的連接
open( [sURL] [, sName] [, sFeatures] [, bReplace])
//打開新窗口,并返回窗口句柄
//sName=(*_blank:打開一個新的未命名窗口;_parent:在父窗口中打開;_search:同時打開搜索窗口;_self:替換本窗口; _top:在頂級窗口里打開;*)
//sFeatures=(*channelmode = { yes | no | 1 | 0 };directories = { yes | no | 1 | 0 };fullscreen = { yes | no | 1 | 0 };height = number;left = number;location = { yes | no | 1 | 0 };menubar = { yes | no | 1 | 0 };resizable = { yes | no | 1 | 0 };scrollbars = { yes | no | 1 | 0 };status = { yes | no | 1 | 0 };titlebar = { yes | no | 1 | 0 };toolbar = { yes | no | 1 | 0 };top = number;width = number;*)
print()
//打印當前窗口文檔內容
prompt( [sMessage] [, sDefaultValue])
//彈出輸入對話框
resizeBy(iX, iY)
//以相對方式改變窗口大小
resizeTo(iWidth, iHeight)
//以絕對方式改變窗口大小
scroll(iX,iY)
滾動窗口,與scrollTo一樣的效果,出于兼容性的考慮保留下來的方法
scrollBy(iX, iY)
//用相對方式滾動窗口
scrollTo(iX, iY)
//用絕對方式滾動窗口
setActive()
//激活目標而不將視線轉向目標
setInterval(vCode, iMilliSeconds [, sLanguage])
//定時執行一段代碼
setTimeout(vCode, iMilliSeconds, sLanguage)
//延時執行一段代碼
showHelp(sURL [, vContextID])
//打開一個幫助文件,sURL為幫助文檔地址,vContextID為幫助索引號
showModalDialog(sURL [, vArguments] [, sFeatures])
showModalDialog(sURL [, vArguments] [, sFeatures])
//打開一個模式對話框
//vArguments=需要向新開模式對話框傳遞的參數
//sFeatures=(*dialogHeight:sHeight;dialogLeft:sXPos;dialogTop:sYPos;dialogWidth:sWidth;center:{ yes | no | 1 | 0 | on | off };dialogHide:{ yes | no | 1 | 0 | on | off };edge:{ sunken | raised };help:{ yes | no | 1 | 0 | on | off };resizable:{ yes | no | 1 | 0 | on | off };scroll:{ yes | no | 1 | 0 | on | off };status:{ yes | no | 1 | 0 | on | off };unadorned:{ yes | no | 1 | 0 | on | off };*)
showModelessDialog(sURL [, vArguments] [, sFeatures])
//打開一個非模式對話框
//vArgument=需要向新開模式對話框傳遞的參數
//sFeatures=(*dialogHeight:sHeight;dialogLeft:sXPos;dialogTop:sYPos;dialogWidth:sWidth;center:{ yes | no | 1 | 0 | on | off };dialogHide:{ yes | no | 1 | 0 | on | off };edge:{ sunken | raised };help:{ yes | no | 1 | 0 | on | off };resizable:{ yes | no | 1 | 0 | on | off };scroll:{ yes | no | 1 | 0 | on | off };status:{ yes | no | 1 | 0 | on | off };unadorned:{ yes | no | 1 | 0 | on | off };*)
********************************************
execCommand的完全參考(中文版)
document.execCommand(sCommand[,交互方式, 動態參數])
2D-Position;document.execCommand("2D-Position","false","true");使絕對定位的對象可直接拖動;ie5.5
AbsolutePosition;document.execCommand("AbsolutePosition","false","true");使對象定位變成絕對定位;ie5.5
BackColor;document.execCommand("BackColor","false",sColor);設置背景顏色;ie4.0
BlockDirLTR;none;使塊級元素排版方式為從左到右?;不支持
BlockDirRTL;none;使塊級元素排版方式為從右到左?;不支持 Bold;document.execCommand("Bold","false",null);使選中區域的文字加粗;ie4.0
BrowseMode;none;設置瀏覽器模式?;不支持 Copy;
document.execCommand("Copy","false",null);復制選中的文字到剪貼板;ie4.0 CreateBookmark;document.execCommand("CreateBookmark","false",sAnchorName);設置指定錨點為書簽;ie4.0
CreateLink;document.execCommand("CreateLink","false",sLinkURL);將選中文本變成超連接,若第二個參數為true,會出現參數設置對話框;ie4.0
Cut;document.execCommand("Cut","false",null);剪貼選中的文字到剪貼板;ie4.0
Delete;document.execCommand("Delete","false",null);刪除選中的文字;ie4.0
DirLTR;none;排版方式為從左到右?;不支持 DirRTL;none;排版方式為從右到左?;不支持
EditMode;none;設置編輯模式?;不支持
FontName;document.execCommand("FontName","false",sFontName);改變選中區域的字體;ie4.0
FontSize;document.execCommand("FontSize","false",sSize|iSize);改變選中區域的字體大小;ie4.0
ForeColor;document.execCommand("ForeColor","false",sColor);設置前景顏色;ie4.0
FormatBlock;document.execCommand("FormatBlock","false",sTagName);設置當前塊的標簽名;ie4.0
********************************************
如何把頁面加入用戶的收藏夾?
<a href="javascript:window.external.AddFavorite('http://www.jb51.net','腳本之家腳本')">收藏腳本之家腳本</a>
********************************************
如何讓瀏覽器在保存頁面時保存失???
<NOSCRIPT>
<IFRAME SRC="*.html">
</IFRAME>
</NOSCRIPT>
********************************************
一個頁面內所有復選框的全選功能如何實現?
<input type=checkbox><input type=checkbox>
<input type=checkbox><input type=checkbox>
<button onclick=SelectAll()>SelectAll</button>
<script>
function SelectAll()
{
var cInput=document.all.tags('INPUT');
for(var i in cInput)
if(cInput[i].type=='checkbox')cInput[i].checked=true;
}
</script>
********************************************
如何在不刷新頁面的情況下刷新css?
<style>
button{ color:#000000;}
</style>
<button onclick=document.styleSheets[0].rules[0].style.color='red'>點擊按鈕直接修改style標簽里button選擇符使按鈕改為紅色</button>