包含javascript:openfullwindowforxtable(‘/page/element/的詞條

本文目錄一覽:

JavaScript的for循環顯示table問題!(1/8/2011線上等)

!doctype html public “-//W3C//DTD HTML 4.0 Transitional//EN”

html

head

title New Document /title

meta name=”Generator” content=”EditPlus”

meta name=”Author” content=””

meta name=”Keywords” content=””

meta name=”Description” content=””

/head

script type=”text/javascript”

function add(){

var table = document.getElementById(“new”);

//var gj = document.getElementById(”);

var gj = 40000;//var gj = document.getElementById(”);可以得到用戶輸入的總金額

var mnk= 9000;//var mnk = document.getElementById(”);可以得到用戶選擇的每年扣多少錢

var nf=2011;//開始的時間

// 增加行

for(var i=0;igj/mnk-1;i++){

var newTR = document.createElement(“tr”);

var newTD1 = document.createElement(“td”);

var newText1 = document.createTextNode(nf+i);

var newTD2 = document.createElement(“td”);

var newText2 = document.createTextNode(mnk);

var newTD3 = document.createElement(“td”);

var newText3 = document.createTextNode(gj-mnk*(i+1));

newTD1.appendChild(newText1);

newTD2.appendChild(newText2);

newTD3.appendChild(newText3);

newTR.appendChild(newTD1);

newTR.appendChild(newTD2);

newTR.appendChild(newTD3);

table.appendChild(newTR);

}

document.getElementById(‘butt’).disabled=true;

}

/script

body

input type=’button’ onclick=’add()’ id=’butt’ value=’計算’/

table border=”1″

tbody id=”new”

tr td年 /td td一年給了多少錢/td td剩下多少錢/td/tr

/tbody

/table

/body

/html

關於JavaScript中的window對象的傳遞問題

firefox中有一個錯誤控制台的工具,很好用。我調試JS都是在firefox下進行的,沒問題了再在IE下檢查。

使用JS一定要考慮瀏覽器兼容性。現在firefox的市場份額不容忽視,所以一個好的JS程序至少應該在主流的幾個瀏覽器下能夠正確運行。編寫的時候遵循W3C標準,一般都不會有什麼問題。

下面這篇文章講述了如何進行JS的調試:

這篇文章講述了JS在IE和Firefox下的兼容性問題:

以下以 IE 代替 Internet Explorer,以 MF 代替 Mozzila Firefox

1. document.form.item 問題

(1)現有問題:

現有代碼中存在許多 document.formName.item(“itemName”) 這樣的語句,不能在 MF 下運行

(2)解決方法:

改用 document.formName.elements[“elementName”]

(3)其它

參見 2

2. 集合類對象問題

(1)現有問題:

現有代碼中許多集合類對象取用時使用 (),IE 能接受,MF 不能。

(2)解決方法:

改用 [] 作為下標運算。如:document.forms(“formName”) 改為 document.forms[“formName”]。

又如:document.getElementsByName(“inputName”)(1) 改為 document.getElementsByName(“inputName”)[1]

(3)其它

3. window.event

(1)現有問題:

使用 window.event 無法在 MF 上運行

(2)解決方法:

MF 的 event 只能在事件發生的現場使用,此問題暫無法解決。可以這樣變通:

原代碼(可在IE中運行):

input type=”button” name=”someButton” value=”提交” onclick=”javascript:gotoSubmit()”/

script language=”javascript”

function gotoSubmit() {

alert(window.event); // use window.event

}

/script

新代碼(可在IE和MF中運行):

input type=”button” name=”someButton” value=”提交” onclick=”javascript:gotoSubmit(event)”/

script language=”javascript”

function gotoSubmit(evt) {

evt = evt ? evt : (window.event ? window.event : null);

alert(evt); // use evt

}

/script

此外,如果新代碼中第一行不改,與老代碼一樣的話(即 gotoSubmit 調用沒有給參數),則仍然只能在IE中運行,但不會出錯。所以,這種方案 tpl 部分仍與老代碼兼容。

4. HTML 對象的 id 作為對象名的問題

(1)現有問題

在 IE 中,HTML 對象的 ID 可以作為 document 的下屬對象變數名直接使用。在 MF 中不能。

(2)解決方法

用 getElementById(“idName”) 代替 idName 作為對象變數使用。

5. 用idName字元串取得對象的問題

(1)現有問題

在IE中,利用 eval(idName) 可以取得 id 為 idName 的 HTML 對象,在MF 中不能。

(2)解決方法

用 getElementById(idName) 代替 eval(idName)。

6. 變數名與某 HTML 對象 id 相同的問題

(1)現有問題

在 MF 中,因為對象 id 不作為 HTML 對象的名稱,所以可以使用與 HTML 對象 id 相同的變數名,IE 中不能。

(2)解決方法

在聲明變數時,一律加上 var ,以避免歧義,這樣在 IE 中亦可正常運行。

此外,最好不要取與 HTML 對象 id 相同的變數名,以減少錯誤。

(3)其它

參見 問題4

7. event.x 與 event.y 問題

(1)現有問題

在IE 中,event 對象有 x, y 屬性,MF中沒有。

(2)解決方法

在MF中,與event.x 等效的是 event.pageX。但event.pageX IE中沒有。

故採用 event.clientX 代替 event.x。在IE 中也有這個變數。

event.clientX 與 event.pageX 有微妙的差別(當整個頁面有滾動條的時候),不過大多數時候是等效的。

如果要完全一樣,可以稍麻煩些:

mX = event.x ? event.x : event.pageX;

然後用 mX 代替 event.x

(3)其它

event.layerX 在 IE 與 MF 中都有,具體意義有無差別尚未試驗。

8. 關於frame

(1)現有問題

在 IE中 可以用window.testFrame取得該frame,mf中不行

(2)解決方法

在frame的使用方面mf和ie的最主要的區別是:

如果在frame標籤中書寫了以下屬性:

frame src=”xx.htm” id=”frameId” name=”frameName” /

那麼ie可以通過id或者name訪問這個frame對應的window對象

而mf只可以通過name來訪問這個frame對應的window對象

例如如果上述frame標籤寫在最上層的window裡面的htm裡面,那麼可以這樣訪問

ie: window.top.frameId或者window.top.frameName來訪問這個window對象

mf: 只能這樣window.top.frameName來訪問這個window對象

另外,在mf和ie中都可以使用window.top.document.getElementById(“frameId”)來訪問frame標籤

並且可以通過window.top.document.getElementById(“testFrame”).src = ‘xx.htm’來切換frame的內容

也都可以通過window.top.frameName.location = ‘xx.htm’來切換frame的內容

關於frame和window的描述可以參見bbs的『window與frame』文章

以及/test/js/test_frame/目錄下面的測試

—-adun 2004.12.09修改

9. 在mf中,自己定義的屬性必須getAttribute()取得

10.在mf中沒有 parentElement parement.children 而用

parentNode parentNode.childNodes

childNodes的下標的含義在IE和MF中不同,MF使用DOM規範,childNodes中會插入空白文本節點。

一般可以通過node.getElementsByTagName()來迴避這個問題。

當html中節點缺失時,IE和MF對parentNode的解釋不同,例如

form

table

input/

/table

/form

MF中input.parentNode的值為form, 而IE中input.parentNode的值為空節點

MF中節點沒有removeNode方法,必須使用如下方法 node.parentNode.removeChild(node)

11.const 問題

(1)現有問題:

在 IE 中不能使用 const 關鍵字。如 const constVar = 32; 在IE中這是語法錯誤。

(2)解決方法:

不使用 const ,以 var 代替。

12. body 對象

MF的body在body標籤沒有被瀏覽器完全讀入之前就存在,而IE則必須在body完全被讀入之後才存在

13. url encoding

在js中如果書寫url就直接寫不要寫例如var url = ‘xx.jsp?objectName=xxobjectEvent=xxx’;

frm.action = url那麼很有可能url不會被正常顯示以至於參數沒有正確的傳到伺服器

一般會伺服器報錯參數沒有找到

當然如果是在tpl中例外,因為tpl中符合xml規範,要求書寫為

一般MF無法識別js中的

14. nodeName 和 tagName 問題

(1)現有問題:

在MF中,所有節點均有 nodeName 值,但 textNode 沒有 tagName 值。在 IE 中,nodeName 的使用好象

有問題(具體情況沒有測試,但我的IE已經死了好幾次)。

(2)解決方法:

使用 tagName,但應檢測其是否為空。

15. 元素屬性

IE下 input.type屬性為只讀,但是MF下可以修改

16. document.getElementsByName() 和 document.all[name] 的問題

(1)現有問題:

在 IE 中,getElementsByName()、document.all[name] 均不能用來取得 div 元素(是否還有其它不能取的元素還不知道)。

NEXT: »» MySQL 的 root 密碼忘記解決辦法

PREV: «« OA數據轉換成功!

評論排序 | 評論:3

引用評論 阿峰 [2005-10-05 08:16:21]

1. 對象問題

1.1 Form對象

現有問題:

現有代碼這獲得form對象通過document.forms(“formName”),這樣使用在IE 能接受,MF 不能。

解決方法:

改用 作為下標運算。改為document.forms[“formName”]

備註

上述的改用 作為下標運算中的formName是id而name

1.2 HTML對象

現有問題:

在 IE 中,HTML 對象的 ID 可以作為 document 的下屬對象變數名直接使用。在 MF 中不能。

document.all(“itemName”)或者document.all(“itemId”)

解決方法:

使用對象ID作為對象變數名

document.getElementById(“itemId”)

備註

document.all是IE自定義的方法,所以請大家盡量不使用。

還有一種方式,在IE和MF都可以使用

var f = document.forms[“formName “];

var o = f. itemId;

1.3 DIV對象

現有問題:

在 IE 中,DIV對象可以使用ID作為對象變數名直接使用。在 MF 中不能。

DivId.style.display = “none”

解決方法:

document.getElementById(“DivId”).style.display = “none”

備註

獲得對象的方法不管是不是DIV對象,都使用getElementById方法。參見1.2

1.4 關於frame

現有問題

在 IE中 可以用window.testFrame取得該frame,mf中不行

解決方法

在frame的使用方面MF和IE的最主要的區別是:

如果在frame標籤中書寫了以下屬性:

那麼IE可以通過id或者name訪問這個frame對應的window對象

而mf只可以通過name來訪問這個frame對應的window對象

例如如果上述frame標籤寫在最上層的window裡面的htm裡面,那麼可以這樣訪問

IE: window.top.frameId或者window.top.frameName來訪問這個window對象

MF:只能這樣window.top.frameName來訪問這個window對象

另外,在mf和ie中都可以使用window.top.document.getElementById(“frameId”)來訪問frame標籤

並且可以通過window.top.document.getElementById(“testFrame”).src = ‘xx.htm’來切換frame的內容

也都可以通過window.top.frameName.location = ‘xx.htm’來切換frame的內容

1.5 窗口

現有問題

IE中可以通過showModalDialog和showModelessDialog打開模態和非模態窗口,但是MF不支持。

解決辦法

直接使用window.open(pageURL,name,parameters)方式打開新窗口。

如果需要傳遞參數,可以使用frame或者iframe。

2. 總結

2.1 在JS中定義各種對象變數名時,盡量使用id,避免使用name。

在 IE 中,HTML 對象的 ID 可以作為 document 的下屬對象變數名直接使用。在 MF 中不能,所以在平常使用時請盡量使用id,避免只使用name,而不使用id。

2.2 變數名與某 HTML 對象 id 相同的問題

現有問題

在 MF 中,因為對象 id 不作為 HTML 對象的名稱,所以可以使用與 HTML 對象 id 相同的變數名,IE 中不能。

解決方法

在聲明變數時,一律加上 var ,以避免歧義,這樣在 IE 中亦可正常運行。

此外,最好不要取與 HTML 對象 id 相同的變數名,以減少錯誤

求個簡單javascript代碼 謝謝,網站菜單功能

不用說自己菜不菜的,能有這個學習的精神已經很值得鼓勵了

呵呵,下面,我來給你介紹幾個網站常見的菜單

第一個:仿網易的滑動門導航菜單

html xmlns=””

head

meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ /

title仿網易的滑動門技術,用DIV+CSS技術實現/title

style type=”text/css”

!–

#header {

background-color: #F8F4EF;

height: 200px;

width: 400px;

margin: 0px;

padding: 0px;

border: 1px solid #ECE1D5;

font-family: “宋體”;

font-size: 12px;

}

#menu {

margin: 0px;

padding: 0px;

list-style-type: none;

}

#menu li {

display: block;

width: 100px;

text-align: center;

float: left;

margin: 0px;

padding-top: 0.2em;

padding-right: 0px;

padding-bottom: 0.2em;

padding-left: 0px;

cursor: hand;

}

.sec1 { background-color: #FFFFCC;}

.sec2 { background-color: #00CCFF;}

.block { display: block;}

.unblock { display: none;}

/style

/head

body

script language=javascript

function secBoard(n)

{

for(i=0;imenu.childNodes.length;i++)

menu.childNodes[i].className=”sec1″;

menu.childNodes[n].className=”sec2″;

for(i=0;imain.childNodes.length;i++)

main.childNodes[i].style.display=”none”;

main.childNodes[n].style.display=”block”;

}

/script

div id=”header”

ul id=”menu”

li onMouseOver=”secBoard(0)” class=”sec2″最新新聞/li

li onMouseOver=”secBoard(1)” class=”sec1″最新文章/li

li onMouseOver=”secBoard(2)” class=”sec1″最新日誌/li

li onMouseOver=”secBoard(3)” class=”sec1″論壇新帖/li

/ul

!–內容顯示區域–

ul id=”main”

li class=”block”第一個內容/li

li class=”unblock”第二個內容/li

li class=”unblock”第三個內容/li

li class=”unblock”第四個內容/li

/ul

!–內容顯示區域–

/div

/body

/html

這裡基本上是使用Css與Div的結合,在整個布局中已層為單位,實行滑動菜單的是一個javascript腳本函數,調用就可以了,看不懂不要緊,日漸積累才是重要

第二個:經典實用的觸髮型導航(這是滑鼠單擊事件控制)

html

head

meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″

title網頁特效代碼|JsCode.CN|—經典實用的觸髮型導航菜單/title

/head

body

STYLE type=text/css.sec1 {

BORDER-RIGHT: gray 1px solid; BORDER-TOP:

#ffffff 1px solid; BORDER-LEFT: #ffffff 1px

solid; CURSOR: hand; COLOR: #000000; BORDER-

BOTTOM: #ffffff 1px solid; BACKGROUND-COLOR:

#eeeeee

}

.sec2 {

BORDER-RIGHT: gray 1px solid; BORDER-TOP:

#ffffff 1px solid; FONT-WEIGHT: bold; BORDER-

LEFT: #ffffff 1px solid; CURSOR: hand; COLOR:

#000000; BACKGROUND-COLOR: #d4d0c8

}

.main_tab {

BORDER-RIGHT: gray 1px solid; BORDER-

LEFT: #ffffff 1px solid; COLOR: #000000; BORDER-

BOTTOM: gray 1px solid; BACKGROUND-COLOR: #d4d0c8

}

/STYLE

!–JavaScript部分–

SCRIPT language=javascript

function secBoard(n)

{

for(i=0;isecTable.cells.length;i++)

secTable.cells

[i].className=”sec1″;

secTable.cells[n].className=”sec2″;

for(i=0;imainTable.tBodies.length;i++)

mainTable.tBodies

[i].style.display=”none”;

mainTable.tBodies

[n].style.display=”block”;

}

/SCRIPT

!–HTML部分–

TABLE id=secTable cellSpacing=0 cellPadding=0 width=549 border=0

TBODY

TR align=middle height=20

TD class=sec2 onclick=secBoard(0) width=”10%”關於TBODY標記/TD

TD class=sec1 onclick=secBoard(1) width=”10%”關於cells集合/TD

TD class=sec1 onclick=secBoard(2) width=”10%”關於tBodies集合/TD

TD class=sec1 onclick=secBoard(3) width=”10%”關於display屬性/TD/TR/TBODY/TABLE

TABLE class=main_tab id=mainTable height=240 cellSpacing=0 cellPadding=0 width=549 border=0!–關於TBODY標記–

TBODY style=”DISPLAY: block”

TR

TD vAlign=top align=middleBRBR

TABLE cellSpacing=0 cellPadding=0 width=490 border=0

TBODY

TR

TD指定行做為表體。

BR注釋:TBODY要素是塊要素,並且需要結束標

簽。BR 即使如果表格沒有顯式定義TBODY

要素,該要素也提供給所有表。BRBR

參考:《動態HTML參考和開發應用大全》(人民郵電出

版社

Microsoft Corporation著

北京華中興業科技發展有限公司

譯)

BRBR/TD/TR/TB

ODY/TABLE/TD/TR/T

BODY!–關於cells集合–

TBODY style=”DISPLAY:

none”

TR

TD vAlign=top

align=middleBRBR

TABLE cellSpacing=0

cellPadding=0 width=490 border=0

TBODY

TR

TD檢索錶行或者整個

表中所有單元格的集合。BR應用於TR、TABLE。

BRBR參考:《動態HTML參考和開發應

用大全》(人民郵電出版社

Microsoft Corporation著

北京華中興業科技發展有限公司

譯)

BRBR/TD/TR/TB

ODY/TABLE/TD/TR/T

BODY!–關於tBodies集合–

TBODY style=”DISPLAY:

none”

TR

TD vAlign=top

align=middleBRBR

TABLE cellSpacing=0

cellPadding=0 width=490 border=0

TBODY

TR

TD檢索表中所有TBODY

對象的集合。對象在該集合中按照HTML源順序排列。

BR應用於TABLE。BRBR參考:

《動態HTML參考和開發應用大全》(人民郵電出版社

Microsoft Corporation著

北京華中興業科技發展有限公司

譯)

BRBR/TD/TR/TB

ODY/TABLE/TD/TR/T

BODY!–關於display屬性–

TBODY style=”DISPLAY:

none”

TR

TD vAlign=top

align=middleBRBR

TABLE cellSpacing=0

cellPadding=0 width=490 border=0

TBODY

TR

TD設置或者檢索對象

是否被提供。BR可能的值為block、none、

inline、list-item、table-header-group、table-

footer-group。BR該特性可讀寫,塊要素默認

值為block,內聯要素默認值為inline;層疊樣式表

(CSS)屬性不可繼承。BRBR參考:《

動態HTML參考和開發應用大全》(人民郵電出版社

Microsoft Corporation著

北京華中興業科技發展有限公司譯)

BRBRA

href=”” target=_blank點擊此處

/A可參閱微軟A href=”” target=_blankMSDN在線/A上的解釋。

/TD/TR/TBODY/TABLE

;/TD/TR/TBODY/TABLEg

t;/body

/html

這裡跟上面不同的區別在與這是滑鼠移動和滑動的事件區別!

第三個:仿拍拍的切換效果菜單(裡面的圖片是我放上去的,所以會看不到圖片的,呵呵 繼續)

!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “”

html xmlns=”” lang=”zh-CN”

head

meta http-equiv=”Content-Language” content=”zh-cn” /

meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ /

meta name=”robots” content=”all” /

title網頁特效|網頁特效代碼(JsHtml.cn)—仿拍拍paipai.com首頁產品圖片隨機輪顯切換效果/titlestyle

body {font-size:12px}

img {border:0px}

#sale{right:206px;top:0;width:260px;background:#fff}

#saleTitle{text-align:right;padding-top:5px;padding-right:5px;width:255px;height:20px;background:url(“images/saleTitle.gif”) no-repeat}

#saleList{margin-top:5px}

#saleList .saleTwo{height:108px;background:url(“images/salelineH.gif”) bottom repeat-x;}

#saleList a{display:block;height:108px;width:86px;text-align:center;float:left;overflow:hidden}

#saleList a.saleItem{background:url(“images/salelineV.gif”) right repeat-y;}

#saleList a img{margin:5px 0}

#saleList a:hover{background-color:#EBFFC5}

/style

script type=”text/javascript”

rnd.today=new Date();

rnd.seed=rnd.today.getTime();

function rnd(){

rnd.seed = (rnd.seed*9301+49297) % 233280;

return rnd.seed/(233280.0);

}

function rand(number){

return Math.ceil(rnd()*number)-1;

}

function nextSale(order){

if(order==”up”) saleNum–;

else saleNum++;

if(saleNum2) saleNum=0

else if(saleNum0) saleNum=2;

//alert(saleNum);

for(i=0;i3;i++)

document.getElementById(“saleList”+i).style.display=”none”;

document.getElementById(“saleList”+saleNum).style.display=””;

}

/script

/head

body

div id=”sale” class=”absolute overflow”

div id=”saleTitle” class=”absolute”

a href=”javascript:nextSale(‘up’)” title=”點擊到上一屏”

img src=”images/saleFore.gif” hspace=”4″ onmouseover=”this.src=’images/saleForeOver.gif'” onmouseout=”this.src=’images/saleFore.gif'” //aa href=”javascript:nextSale(‘down’)” title=”點擊到下一屏”img src=”images/saleNext.gif” onmouseover=”this.src=’images/saleNextOver.gif'” onmouseout=”this.src=’images/saleNext.gif'” //a/div

div class=”overflow” style=”height:330px” id=”saleList”

script type=”text/javascript”var saleNum=rand(3);/script

div id=”saleList0″ style=”display:none”

div class=”saleTwo”

a class=”saleItem” href=”” target=”_blank”

div

img alt=”聖誕浪漫飾品超級大促” src=”/jsimages/UploadFiles_3321/200804/20080423085515804.jpg” width=”65″ height=”65″ //div

div

聖誕浪漫飾品br /

超級大促/div

/a

a class=”saleItem” href=”” target=”_blank”

div

img alt=”攝像頭集結號給你新的感覺” src=”/jsimages/UploadFiles_3321/200804/20080423085516472.jpg” width=”65″ height=”65″ //div

div

攝像頭集結號br /

給你新的感覺/div

/aa href=”” target=”_blank”

div

img alt=”好感度提升韓版娃娃裝” src=”/jsimages/UploadFiles_3321/200804/20080423085516162.jpg” width=”65″ height=”65″ //div

div

好感度提升br /

韓版娃娃裝/div

/a/div

div class=”saleTwo”

a class=”saleItem” href=”” target=”_blank”

div

img alt=”復古牛仔外套特惠119元起” src=”/jsimages/UploadFiles_3321/200804/20080423085516293.jpg” width=”65″ height=”65″ //div

div

復古牛仔外套br /

特惠119元起/div

/a

a class=”saleItem” href=”” target=”_blank”

div

img alt=”聖誕拍拍特供運動服3折” src=”/jsimages/UploadFiles_3321/200804/20080423085516802.jpg” width=”65″ height=”65″ //div

div

聖誕拍拍特供br /

運動服3折/div

/aa href=”” target=”_blank”

div

img alt=”攝像頭集結號給你新的感覺” src=”/jsimages/UploadFiles_3321/200804/20080423085516472.jpg” width=”65″ height=”65″ //div

div

攝像頭集結號br /

給你新的感覺/div

/a/div

div

a class=”saleItem” href=”” target=”_blank”

div

img alt=”聖誕拍拍特供電腦周邊4折” src=”/jsimages/UploadFiles_3321/200804/20080423085516530.jpg” width=”65″ height=”65″ //div

div

聖誕拍拍特供br /

電腦周邊4折/div

/a

a class=”saleItem” href=”” target=”_blank”

div

img alt=”party扮靚甜美腮紅” src=”/jsimages/UploadFiles_3321/200804/20080423085516658.jpg” width=”65″ width=”65″ height=”65″ //div

div

party扮靚br /

甜美腮紅/div

/aa href=”” target=”_blank”

div

img alt=”好感度提升韓版娃娃裝” src=”/jsimages/UploadFiles_3321/200804/20080423085516162.jpg” width=”65″ height=”65″ //div

div

好感度提升br /

韓版娃娃裝/div

/a/div

/div

div id=”saleList1″ style=”display:none”

div class=”saleTwo”

a class=”saleItem” href=”” target=”_blank”

div

img alt=”新奇好玩便宜盡在網遊頻道” src=”/jsimages/UploadFiles_3321/200804/20080423085516612.jpg” width=”65″ height=”65″ //div

div

新奇好玩便宜br /

盡在網遊頻道/div

/a

a class=”saleItem” href=”” target=”_blank”

div

img alt=”展現高貴氣質騎士系馬靴” src=”/jsimages/UploadFiles_3321/200804/20080423085516202.jpg” width=”65″ height=”65″ //div

div

展現高貴氣質br /

騎士系馬靴/div

/aa href=”” target=”_blank”

div

img alt=”攝像頭集結號給你新的感覺” src=”/jsimages/UploadFiles_3321/200804/20080423085516472.jpg” width=”65″ height=”65″ //div

div

攝像頭集結號br /

給你新的感覺/div

/a/div

div class=”saleTwo”

a class=”saleItem” href=”” target=”_blank”

div

img alt=”永不過時條紋毛衣” src=”/jsimages/UploadFiles_3321/200804/20080423085516984.jpg” width=”65″ height=”65″ //div

div

永不過時br /

條紋毛衣/div

/a

a class=”saleItem” href=”” target=”_blank”

div

img alt=”聖誕拍拍特供運動鞋2折” src=”/jsimages/UploadFiles_3321/200804/20080423085516651.jpg” width=”65″ height=”65″ //div

div

聖誕拍拍特供br /

運動鞋2折/div

/aa href=”” target=”_blank”

div

img alt=”好感度提升韓版娃娃裝” src=”/jsimages/UploadFiles_3321/200804/20080423085516162.jpg” width=”65″ height=”65″ //div

div

好感度提升br /

韓版娃娃裝/div

/a/div

div

a class=”saleItem” href=”” target=”_blank”

div

img alt=”精簡唯美索愛K630″ src=”/jsimages/UploadFiles_3321/200804/20080423085516302.jpg” width=”65″ height=”65″ //div

div

精簡唯美br /

索愛K630/div

/a

a class=”saleItem” href=”” target=”_blank”

div

img alt=”原裝瑞士軍刀精選” src=”/jsimages/UploadFiles_3321/200804/20080423085516549.jpg” width=”65″ width=”65″ height=”65″ //div

div

原裝瑞士軍刀br /

精選/div

/aa href=”” target=”_blank”

div

img alt=”超薄機身索愛W880″ src=”/jsimages/UploadFiles_3321/200804/20080423085516711.jpg” width=”65″ height=”65″ //div

div

超薄機身br /

索愛W880/div

/a/div

/div

div id=”saleList2″ style=”display:none”

div class=”saleTwo”

a class=”saleItem” href=”” target=”_blank”

div

img alt=”各就各味秋冬飲食計劃” src=”/jsimages/UploadFiles_3321/200804/20080423085516704.jpgtype=3″ width=”65″ height=”65″ //div

div

各就各味br /

秋冬飲食計劃/div

/aa href=”” target=”_blank”

div

img alt=”好感度提升韓版娃娃裝” src=”/jsimages/UploadFiles_3321/200804/20080423085516162.jpg” width=”65″ height=”65″ //div

div

好感度提升br /

韓版娃娃裝/div

/a/div

div class=”saleTwo”

a class=”saleItem” href=”” target=”_blank”

div

img alt=”聖誕拍拍特供隨身視聽5折” src=”/jsimages/UploadFiles_3321/200804/20080423085516375.jpg” width=”65″ height=”65″ //div

div

聖誕拍拍特供br /

隨身視聽5折/div

/aa href=”” target=”_blank”

div

img alt=”超薄機身索愛W880″ src=”/jsimages/UploadFiles_3321/200804/20080423085516711.jpg” width=”65″ height=”65″ //div

div

超薄機身br /

索愛W880/div

/a/div

div

a class=”saleItem” href=”” target=”_blank”

div

img alt=”我愛我家家居大搶購” src=”/jsimages/UploadFiles_3321/200804/20080423085516954.jpg” width=”65″ height=”65″ //div

div

我愛我家br /

家居大搶購/div

/aa href=”” target=”_blank”

div

img alt=”超值彩妝套裝變身派對女王” src=”/jsimages/UploadFiles_3321/200804/20080423085516919.jpg” width=”65″ width=”65″ height=”65″ //div

div

超值彩妝套裝br /

變身派對女王/div

/a/div

/div

/div

/div

script type=”text/javascript”document.getElementById(“saleList”+saleNum).style.display=””;/script

p /p

p更多網頁特效代碼盡在 a href=””網頁特效代碼/a/p

/body

/html

這個仿拍拍基本上就是2層放圖片,但用起來的效果還是可以的,如果不喜歡我還有下面呢,慢慢學,總會看懂的 (最重要的還是Css哦)

這個主要就是讓層實現隱藏 我覺得這個在層使用方面還是好的

從總體上看,在實現層與層之間的交互,在其代碼 我覺得你有必要去認真看下 !

以上是我介紹額度菜單,雖然不是很強大,但是卻很使用,而且在J2EE中

菜單基本上是一個假象,都是用層與Css之間的特效做出來的!

學會了層的具體應用,我相信你也可以有自己特色的菜單的

那我祝你好運咯!!加油!!

JavaScript常用語句標識符有哪些

這裡有些平常整理的資料,希望你能了解。碼瘋窩。

1.document.write( ” “); 輸出語句

2.JS中的注釋為//

3.傳統的HTML文檔順序是:document- html- (head,body)

4.一個瀏覽器窗口中的DOM順序是:window- (navigator,screen,history,location,document)

5.得到表單中元素的名稱和值:document.getElementById( “表單中元素的ID號 “).name(或value)

6.一個小寫轉大寫的JS: document.getElementById( “output “).value = document.getElementById( “input “).value.toUpperCase();

7.JS中的值類型:String,Number,Boolean,Null,Object,Function

8.JS中的字元型轉換成數值型:parseInt(),parseFloat()

9.JS中的數字轉換成字元型:( ” ” 變數)

10.JS中的取字元串長度是:(length)

11.JS中的字元與字元相連接使用號.

12.JS中的比較操作符有:==等於,!=不等於, , =, . =

13.JS中聲明變數使用:var來進行聲明

14.JS中的判定語句結構:if(condition){}else{}

15.JS中的循環結構:for([initial expression];[condition];[upadte expression]) {inside loop}

16.循環中止的命令是:break

17.JS中的函數定義:function functionName([parameter],…){statement[s]}

18.當文件中出現多個form表單時.可以用document.forms[0],document.forms[1]來代替.

19.窗口:打開窗口window.open(), 關閉一個窗口:window.close(), 窗口本身:self

20.狀態欄的設置:window.status= “字元 “;

21.彈出提示信息:window.alert( “字元 “);

22.彈出確認框:window.confirm();

23.彈出輸入提示框:window.prompt();

24.指定當前顯示鏈接的位置:window.location.href= “URL “

25.取出窗體中的所有表單的數量:document.forms.length

26.關閉文檔的輸出流:document.close();

27.字元串追加連接符: =

28.創建一個文檔元素:document.createElement(),document.createTextNode()

29.得到元素的方法:document.getElementById()

30.設置表單中所有文本型的成員的值為空:

var form = window.document.forms[0]

for (var i = 0; i

if (form.elements.type == “text “){

form.elements.value = ” “;

}

}

31.複選按鈕在JS中判定是否選中:document.forms[0].checkThis.checked (checked屬性代表為是否選中返回TRUE或FALSE)

32.單選按鈕組(單選按鈕的名稱必須相同):取單選按鈕組的長度document.forms[0].groupName.length

33.單選按鈕組判定是否被選中也是用checked.

34.下拉列表框的值:document.forms[0].selectName.options[n].value (n有時用下拉列表框名稱加上.selectedIndex來確定被選中的值)

35.字元串的定義:var myString = new String( “This is lightsword “);

36.字元串轉成大寫:string.toUpperCase(); 字元串轉成小寫:string.toLowerCase();

37.返回字元串2在字元串1中出現的位置:String1.indexOf( “String2 “)!=-1則說明沒找到.

38.取字元串中指定位置的一個字元:StringA.charAt(9);

39.取出字元串中指定起點和終點的子字元串:stringA.substring(2,6);

40.數學函數:Math.PI(返回圓周率),Math.SQRT2(返回開方),Math.max(value1,value2)返回兩個數中的最在值,Math.pow(value1,10)返回

value1的十次方,Math.round(value1)四捨五入函數,Math.floor(Math.random()*(n 1))返回隨機數

41.定義日期型變數:var today = new Date();

42.日期函數列表:dateObj.getTime()得到時間,dateObj.getYear()得到年份,dateObj.getFullYear()得到四位的年份,dateObj.getMonth()得

到月份,dateObj.getDate()得到日,dateObj.getDay()得到日期幾,dateObj.getHours()得到小時,dateObj.getMinutes()得到

分,dateObj.getSeconds()得到秒,dateObj.setTime(value)設置時間,dateObj.setYear(val)設置年,dateObj.setMonth(val)設置

月,dateObj.setDate(val)設置日,dateObj.setDay(val)設置星期幾,dateObj.setHours設置小時,dateObj.setMinutes(val)設置

分,dateObj.setSeconds(val)設置秒 [注重:此日期時間從0開始計]

43.FRAME的表示方式: [window.]frames[n].ObjFuncVarName,frames[ “frameName “].ObjFuncVarName,frameName.ObjFuncVarName

44.parent代表父親對象,top代表最頂端對象

45.打開子窗口的父窗口為:opener

46.表示當前所屬的位置:this

47.當在超鏈接中調用JS函數時用:(javascript :)來開頭後面加函數名

48.在老的瀏覽器中不執行此JS:

在JavaScript中用window.open()新打開一個窗口

open Method Internet Development Index

——————————————————————————–

Opens a new window and loads the document specified by a given URL.

What’s New for Microsoft® Internet Explorer 6

As of Internet Explorer 6, the _media value of the sName parameter specifies that this method loads a URL into the HTML content area of the Media Bar.

Syntax

oNewWindow = window.open( [sURL] [, sName] [, sFeatures] [, bReplace])

Parameters

sURL Optional. String that specifies the URL of the document to display. If no URL is specified, a new window with about:blank is displayed.

sName Optional. String that specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an a element._blank The sURL is loaded into a new, unnamed window.

_media The sURL is loaded into the HTML content area of the Media Bar. Available in Internet Explorer 6 or later.

_parent The sURL is loaded into the current frame’s parent. If the frame has no parent, this value acts as the value _self.

_search Available in Internet Explorer 5 and later. The sURL is opened in the browser’s search pane.

_self The current document is replaced with the specified sURL .

_top sURL replaces any framesets that may be loaded. If there are no framesets defined, this value acts as the value _self.

sFeatures Optional. This String parameter is a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, “fullscreen=yes, toolbar=yes”). The following features are supported.channelmode = { yes | no | 1 | 0 } Specifies whether to display the window in theater mode and show the channel band. The default is no.

directories = { yes | no | 1 | 0 } Specifies whether to add directory buttons. The default is yes.

fullscreen = { yes | no | 1 | 0 } Specifies whether to display the browser in full-screen mode. The default is no. Use full-screen mode carefully. Because this mode hides the browser’s title bar and menus, you should always provide a button or other visual clue to help the user close the window. ALT+F4 closes the new window. A window in full-screen mode must also be in theater mode (channelmode).

height = number Specifies the height of the window, in pixels. The minimum value is 100.

left = number Specifies the left position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.

location = { yes | no | 1 | 0 } Specifies whether to display the input field for entering URLs directly into the browser. The default is yes.

menubar = { yes | no | 1 | 0 } Specifies whether to display the menu bar. The default is yes.

resizable = { yes | no | 1 | 0 } Specifies whether to display resize handles at the corners of the window. The default is yes.

scrollbars = { yes | no | 1 | 0 } Specifies whether to display horizontal and vertical scroll bars. The default is yes.

status = { yes | no | 1 | 0 } Specifies whether to add a status bar at the bottom of the window. The default is yes.

titlebar = { yes | no | 1 | 0 } Specifies whether to display a title bar for the window. This parameter is ignored unless the calling application is an HTML Application or a trusted dialog box. The default is yes.

toolbar = { yes | no | 1 | 0 } Specifies whether to display the browser toolbar, making buttons such as Back, Forward, and Stop available. The default is yes.

top = number Specifies the top position, in pixels. This value is relative to the upper-left corner of the screen. The value must be greater than or equal to 0.

width = number Sets the width of the window, in pixels. The minimum value is 100.

bReplace Optional. When the sURL is loaded into the same window, this Boolean parameter specifies whether the sURL creates a new entry or replaces the current entry in the window’s history list. true sURL replaces the current document in the history list

false sURL creates a new entry in the history list.

Return Value

Returns a reference to the new window object. Use this reference to access properties and methods on the new window.

Remarks

By default, the open method creates a window that has a default width and height and the standard menu, toolbar, and other features of Internet Explorer. You can alter this set of features by using the sFeatures parameter. This parameter is a string consisting of one or more feature settings.

When the sFeatures parameter is specified, the features that are not defined in the parameter are disabled. Therefore, when using the sFeatures parameter, it is necessary to enable all the features that are to be included in the new window. If the sFeatures parameter is not specified, the window features maintain their default values. In addition to enabling a feature by setting it to a specific value, simply listing the feature name also enables that feature for the new window.

Internet Explorer 5 allows further control over windows through the implementation of title in the sFeatures parameter of the open method. Turn off the title bar by opening the window from a trusted application, such as Microsoft Visual Basic® or an HTML Application (HTA). These applications are considered trusted, because each uses Internet Explorer interfaces instead of the browser.

When a function fired by an event on any object calls the open method, the window.open method is implied.

SHOWExample

SCRIPT LANGUAGE=”JScript”

function foo() {

open(‘about:blank’);}

/SCRIPT

BODY onclick=”foo();”

Click this page and window.open() is called.

/BODY

When an event on any object calls the open method, the document.open method is implied.

BUTTON onclick=”open(‘Sample.htm’);”

Click this button and document.open() is called.

/BUTTON

Example

This example uses the open method to create a new window that contains Sample.htm. The new window is 200 pixels by 400 pixels and has a status bar, but it does not have a toolbar, menu bar, or address field.

window.open(“Sample.htm”,null,

“height=200,width=400,status=yes,toolbar=no,menubar=no,location=no”);

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/293774.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-12-26 13:15
下一篇 2024-12-26 13:15

相關推薦

  • 使用JavaScript日期函數掌握時間

    在本文中,我們將深入探討JavaScript日期函數,並且從多個視角介紹其應用方法和重要性。 一、日期的基本表示與獲取 在JavaScript中,使用Date對象來表示日期和時間,…

    編程 2025-04-28
  • JavaScript中使用new Date轉換為YYYYMMDD格式

    在JavaScript中,我們通常會使用Date對象來表示日期和時間。當我們需要在網站上顯示日期時,很多情況下需要將Date對象轉換成YYYYMMDD格式的字元串。下面我們來詳細了…

    編程 2025-04-27
  • JavaScript中修改style屬性的方法和技巧

    一、基本概念和方法 style屬性是JavaScript中一個非常重要的屬性,它可以用來控制HTML元素的樣式,包括顏色、大小、字體等等。這裡介紹一些常用的方法: 1、通過Java…

    編程 2025-04-25
  • CloneDeep函數在Javascript開發中的應用

    一、CloneDeep的概念 CloneDeep函數在Javascript中是一種深層克隆對象的方法,可以在拷貝對象時避免出現引用關係。使用者可以在函數中設置可選參數使其滿足多種拷…

    編程 2025-04-25
  • JavaScript中的Object.getOwnPropertyDescriptors()

    一、簡介 Object.getOwnPropertyDescriptors()是JavaScript中一個非常有用的工具。簡單來說,這個方法可以獲取一個對象上所有自有屬性的屬性描述…

    編程 2025-04-25
  • JavaScript保留整數的完整指南

    JavaScript是一種通用腳本語言,非常適合Web應用程序開發。在處理數字時,JavaScript可以處理整數和浮點數。在本文中,我們將重點關注JavaScript如何保留整數…

    編程 2025-04-25
  • JavaScript點擊事件全方位指南

    一、click事件基礎 click事件是最常用的滑鼠事件之一,當元素被單擊時觸發。click事件適用於大多數HTML元素(<a>、<button>)和SVG…

    編程 2025-04-25
  • 詳解JavaScript onclick事件

    一、onclick的基礎知識 onclick事件是JavaScript中最常用的事件之一,它在用戶點擊某個HTML元素時觸發。通常我們可以通過給元素添加一個onclick屬性來綁定…

    編程 2025-04-25
  • JavaScript淺拷貝

    一、什麼是淺拷貝 在JavaScript中,淺拷貝是一種將源對象的屬性複製到目標對象中的方法。淺拷貝的實現方式有多種,包括直接賦值、Object.assign()、展開運算符、co…

    編程 2025-04-25
  • JavaScript 數組轉成字元串

    一、數組轉成字元串的基本操作 在 JS 中,將數組轉成字元串是一項最基本但也最常見的操作之一。我們可以使用 Array 類型內置的 join() 方法實現。它將數組的元素連接成一個…

    編程 2025-04-25

發表回復

登錄後才能評論