锘??xml version="1.0" encoding="utf-8" standalone="yes"?>
1.錛圛E嫻忚鍣級榪炵畫鐨勮嫳鏂囧瓧絎﹀拰闃挎媺浼暟瀛?浣跨敤word-wrap : break-word ;鎴栬厀ord-break:break-all;瀹炵幇寮哄埗鏂 #wrap{word-break:break-all; width:200px;} <div id="wrap">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div> 鏁堟灉錛氬彲浠ュ疄鐜版崲琛?/p>
2.錛團irefox嫻忚鍣級榪炵畫鐨勮嫳鏂囧瓧絎﹀拰闃挎媺浼暟瀛楃殑鏂,Firefox鐨勬墍鏈夌増鏈殑娌℃湁瑙e喅榪欎釜闂,鎴戜滑鍙湁璁╄秴鍑鴻竟鐣岀殑瀛楃闅愯棌鎴栬?緇欏鍣ㄦ坊鍔犳粴鍔ㄦ潯
<div id="wrap">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div> 鏁堟灉錛氬鍣ㄦ甯革紝鍐呭闅愯棌 瀵逛簬table 1. (IE嫻忚鍣?浣跨敤 table-layout:fixed;寮哄埗table鐨勫搴?澶氫綑鍐呭闅愯棌 <table style="table-layout:fixed" width="200"> 鏁堟灉錛氶殣钘忓浣欏唴瀹?/p>
2.(IE嫻忚鍣?浣跨敤 table-layout:fixed;寮哄埗table鐨勫搴?鍐呭眰td,th閲囩敤word-break : break-all;鎴栬厀ord-wrap : break-word ;鎹㈣ <table width="200" style="table-layout:fixed;"> 鏁堟灉錛氬彲浠ユ崲琛?/p>
3. (IE嫻忚鍣?鍦╰d,th涓祵濂梔iv,p絳夐噰鐢ㄤ笂闈㈡彁鍒扮殑div,p鐨勬崲琛屾柟娉?/p>
4.(Firefox嫻忚鍣?浣跨敤 table-layout:fixed;寮哄埗table鐨勫搴?鍐呭眰td,th閲囩敤word-break : break-all;鎴栬厀ord-wrap : break-word ;鎹㈣錛屼嬌鐢╫verflow:hidden;闅愯棌瓚呭嚭鍐呭錛岃繖閲宱verflow:auto;鏃犳硶璧蜂綔鐢?/p>
鏁堟灉錛氶殣钘忓浜庡唴瀹?/p>
5.(Firefox嫻忚鍣? 鍦╰d,th涓祵濂梔iv,p絳夐噰鐢ㄤ笂闈㈡彁鍒扮殑瀵逛粯Firefox鐨勬柟娉?br />榪愯浠g爜妗?br />鏈鍚庯紝榪欑鐜拌薄鍑虹幇鐨勫嚑鐜囧緢灝忥紝浣嗘槸涓嶈兘鎺掗櫎緗戝弸鐨勬伓鎼炪?/p>
涓嬮潰鏄彁鍒扮殑渚嬪瓙鐨勬晥鏋?/p>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head> <h1><code>IE \ word-wrap : break-word ;</code></h1> <h1><code>Firefox/ word-break:break-all; overflow:auto;</code></h1>
<element>.replaceChild(newNode,oldNode)
<elemnet>.hasChildNodes()
<element>.tagName
<element>.getAttributeNode()
<element>.getElementsByTagName()
<element>.hasAttribute()
<element>.removeAttributeNode()
<element>.setAttributeNode()
Node瀵硅薄甯哥敤灞炴?
<element>.attributes
<element>.childNodes
<element>.firstChild
<element>.lastChild
<element>.nextSibling
<element>.previousSibling
<element>.parentNode
<element>.nodeType
<element>.nodeName
<html>
<head>
<title>嫻嬭瘯</title>
</head>
<script language="javascript">
function show()
{
聽聽聽聽聽聽聽聽 var showdiv聽聽聽聽聽聽聽聽 =聽聽聽聽聽聽聽聽 document.createElement("div");
聽聽聽聽聽聽聽聽 showdiv.setAttribute("id","div1");
聽聽聽聽聽聽聽聽 showdiv.innerHTML = "榪欏氨鏄墍璋撶殑鍔ㄦ佸垱寤猴紒";
聽聽聽聽聽聽聽聽 showdiv.style.height = "100px";
聽聽聽聽聽聽聽聽 showdiv.style.backgroundColor = "yellow";
聽聽聽聽聽聽聽聽 document.body.appendChild(showdiv);
}
</script>
<body>
<a href="javascript:show();">鐐規垜</a>
</body>
</html>
鍓嶈█錛氫笌浼犵粺鐨勬柟娉曚笉鍚岋紝DOM浣滀負涓縐嶁滄墜鏈垁鈥濆瀷鐨勫紑鍙戝伐鍏瘋兘澶熷document鍋氬埌鈥滅粏鑷村叆寰濈殑鐓ч【銆傚洜涓篋OM鏄熀浜庢枃妗f爲妯″瀷寤虹珛璧鋒潵鐨勪竴濂楁柟娉曞洜姝よ兘澶熷鏂囨。鍋氬嚑涔庝換浣曟柟闈㈢殑淇敼銆備笉璁烘偍鏄笇鏈涗慨鏀圭粨鏋勮繕鏄湪鍐呭錛屼嬌鐢―OM閮芥槸涓涓笉閿欑殑閫夋嫨銆?br />浠婂ぉ瑕佽皥鍒板埌浜嗘槸鍥涗釜鍏稿瀷鐨凞OM鏂規硶浠ュ強浠栦滑鐨勪嬌鐢ㄧ瓥鐣ワ細
createElement()鏂規硶 createTextNode()鏂規硶 appendChild()鏂規硶 insertBefore()鏂規硶1.creatElement()鏂規硶
瑙勫垯document.creatElement(nodeName)
渚嬪鎴戜滑鍙互浣跨敤濡備笅鐨勮鍙ユ潵鍒涘緩涓涓钀姐?br />document.creatElement("p")
2.creatTextNode()鏂規硶
瑙勫垯document.creatTextNode(text)
渚嬪鎴戜滑鍙互浣跨敤濡備笅璇彞鏉ュ垱寤轟竴鏉¤鍙ョ敤鏉ラ棶鍊欏ぇ瀹躲?br />document.creatTextNode("Hello World")
3.appendChild()鏂規硶
瑙勫垯parent.appendChild(child)
鍒涘緩浜嗘墍闇瑕佺殑緇撴瀯鎴栧唴瀹逛互鍚庤繕闇瑕佸皢鎵鍒涘緩鐨勪笢瑗挎彃鍏ュ埌鏂囨。褰撲腑鎵嶈兘綆楁垚鍔熴備緥濡傛垜浠彲浠ヤ嬌鐢ㄥ涓嬬殑鏂規硶鏉ュ緩绔嬭搗鎴戜滑闇瑕佸垱寤虹殑HTML鍐呭銆傝娉ㄦ剰榪欏畬鍏ㄦ槸鍔ㄦ佸緩绔嬬殑銆?br />var para = document.createElement("p");
var testdiv = document.getElementById("testdiv");
var txt = document.createTextNode("Hello World");
testdiv.appendChild(para);
para.appendChild(txt);
榪欐牱鎴戜滑灝辨妸涔嬪墠鎵寤虹珛鐨勭粨鏋勪笌鍐呭鎻掑鍒頒簡鎴戜滑鎵闇瑕佺殑鍦版柟銆備笉榪囬棶棰樹篃闅忎箣鑰屾潵錛宎ppendChild()鏂規硶鍙兘鍒涘緩宸茬煡鍏冪礌緇撶偣鐨勬渶鍚庝竴涓瓙緇撶偣錛屽鏋滃綋鐖跺厓绱犲凡緇忔嫢鏈夊嚑涓瓙鍏冪礌鐨勬椂鍊欙紝鎴戜滑鏄棤娉曢氳繃appendChild()鏂規硶鏉ラ夋嫨鎻掑叆鐐圭殑銆?br />4.insertBefore()鏂規硶
瑙勫垯parentElement.inserBefore(newElemenet,targetElement)
鍦ㄤ嬌鐢ㄧ殑鏃跺欙紝鎴戜滑涓嶉渶瑕佺煡閬撶埗鍏冪礌鍒板簳鏄皝錛屽洜涓烘垜浠彲浠ラ氳繃榪欐牱鐨勮娉曡幏寰楃埗鍏冪礌錛?br />targetElement.parentNode
榪欐牱鐪嬩笂鍘諱技涔庢湁鐐瑰ソ絎戯紝褰撳埆浜洪棶浣犵埗浜叉槸璋佺殑鏃跺欙紝浣犲嵈鍛婅瘔鍒漢錛屾垜鐨勭埗浜插氨鏄滄垜鐨勭埗浜測濄備笉榪囧湪DOM涓紝瀹冪‘瀹炲氨鏄竴涓兘瀹為檯浣跨敤鐨勬柟娉曘?br />
琛ュ厖涓涓湁鎰忎箟鐨勫嚱鏁幫細
褰撶湅鍒版湁insertBefore()鏂規硶涔嬪悗錛屼篃璁鎬細鎯沖綋鐒剁殑璁や負榪樻湁insertAfter()鏂規硶銆備笉榪囪璁╀綘澶辨湜浜嗭紝DOM騫舵病鏈夋彁渚涜繖鏍風殑鏂規硶銆傛垜鎯蟲槸鍥犱負瀹冨彲浠ラ氳繃娣峰悎浣跨敤insertBefore()鏂規硶鍜宎ppendChild()鏂規硶鏉ュ疄鐜板惂銆備絾鏄紝鎴戜滑鎬誨笇鏈涘畠鑳藉鏄縐般傛墍浠ユ垜浠嚜宸卞姩鎵嬬紪鍐欎竴涓猧nsertAfter()鏂規硶錛屾妸瀹冧綔涓哄嚱鏁板瓨鏀懼湪鎴戜滑鐨勬枃妗d腑銆?br />function insertAfter(newelElement,targetElement) {
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement) {
parent.appendChild(newElement);
}else {
parent.insertBefore(newElement,targetElement.nextSibling);
}
}
鑷蟲錛屾垜浠嚦灝戣兘澶熺敤浠ヤ笂鐨勫嚑涓狣OM鏂規硶鏉ュ垱寤虹畝鍗曠殑HTML鏂囨。銆備嬌鐢―OM鐨勫ソ澶勬湁涓ょ偣錛氱涓錛屾枃妗d笌琛屼負浜掔浉鍒嗙錛岃繖絎﹀悎鐜頒唬宸ョ▼瀛︾殑鍏堣繘鐞嗗康銆傝鏃跺埢璁頒綇錛屾販鍚堝湪涓璧風殑姘歌繙閮戒笉鏄渶濂界殑鍔炴硶銆傜浜岋紝鍔ㄦ佸垱寤虹殑緇撴瀯涓庡唴瀹瑰茍涓嶅獎鍝嶅師鍏堢殑鏂囨。鍐呭錛岃繖鏍蜂嬌寰楁垜浠兘娓呮鐨勫畬鎴愨滄浛鎹⑩濅笌鈥滄彃鍏モ濈殑涓嶅悓鎿嶄綔銆?br />鏄殑DOM灝辨槸榪欐牱涓縐嶇粏鑷寸殑宸ュ叿銆傜粏鑷磋屽己澶х殑紜槸DOM鑳藉鍦ㄤ笘鐣屼笂鎴愪負鏍囧噯鐨勬湁鍔涙潯浠躲?/font>
]]>
瀵逛簬div,p絳夊潡綰у厓绱?
姝e父鏂囧瓧鐨勬崲琛?浜氭床鏂囧瓧鍜岄潪浜氭床鏂囧瓧)鍏冪礌鎷ユ湁榛樿鐨剋hite-space:normal,褰撳畾涔夌殑瀹藉害涔嬪悗鑷姩鎹㈣
html
<div id="wrap">姝e父鏂囧瓧鐨勬崲琛?浜氭床鏂囧瓧鍜岄潪浜氭床鏂囧瓧)鍏冪礌鎷ユ湁榛樿鐨剋hite-space:normal,褰撳畾涔?lt;/div>
css
#wrap{white-space:normal; width:200px; }
鎴栬?br />#wrap{word-wrap:break-word; width:200px;}
#wrap{word-break:break-all; width:200px; overflow:auto;}
<tr>
<td>abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss
</td>
</tr>
</table>
<tr>
<td width="25%" style="word-break : break-all; ">abcdefghigklmnopqrstuvwxyz 1234567890
</td>
<td style="word-wrap : break-word ;">abcdefghigklmnopqrstuvwxyz 1234567890
</td>
</tr>
</table>
<table style="table-layout:fixed" width="200">
<tr>
<td width="25%" style="word-break : break-all; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<td width="75%" style="word-wrap : break-word; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>瀛楃鎹㈣</title>
<style type="text/css">
table,td,th,div { border:1px green solid;}
code { font-family:"Courier New", Courier, monospace;}
</style>
</head>
<body>
<h1><code>div</code></h1>
<h1><code>All white-space:normal;</code></h1>
<div style="white-space:normal; width:200px;">Wordwrap still occurs in a td element that has its WIDTH attribute set to a value smaller than the unwrapped content of the cell, even if the noWrap property is set to true. Therefore, the WIDTH attribute takes precedence over the noWrap property in this scenario</div>
<div style="word-wrap : break-word ; width:200px;">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<h1><code>IE \ word-break:break-all;</code></h1>
<div style="word-break:break-all;width:200px;">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<div style="word-break:break-all; width:200px; overflow:auto;">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div>
<h1><code>table</code></h1>
<h1><code>table-layout:fixed;</code></h1>
<table style="table-layout:fixed" width="200">
<tr>
<td>abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
</tr>
</table>
<h1><code>table-layout:fixed; word-break : break-all; word-wrap : break-word ;</code></h1>
<table width="200" style="table-layout:fixed;">
<tr>
<td width="25%" style="word-break : break-all; ">abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
<td style="word-wrap : break-word ;">abcdefghigklmnopqrstuvwxyz1234567890ssssssssssssss</td>
</tr>
</table>
<h1><code>FF \ table-layout:fixed; overflow:hidden;</code></h1>
<table style="table-layout:fixed" width="200">
<tr>
<td width="25%" style="word-break : break-all; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
<td width="75%" style="word-wrap : break-word; overflow:hidden; ">abcdefghigklmnopqrstuvwxyz1234567890</td>
</tr>
</table>
</body>
</html>
]]>
1.甯哥敤jsp澶撮儴
<%@ include file="/jsp/common/taglib.jsp"%>
<%@ page import="cn.com.sunrise.home.util.Constraint"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="<%@ taglib prefix="tangs" uri="/WEB-INF/pagination.tld"%>
2.甯哥敤
<c:if test="${sessionScope.userAccount == 'admin'}">
聽</c:if>
<c:if test="${not empty sessionScope.userAccount}">
</c:if>
鐢蟲槑int rank =0;
<c:forEach var="type" items="${productTypeList}"聽 varStatus="ls">
聽聽聽聽聽聽<c:if test="${ls.first}"></c:if>
聽聽 聽聽聽聽聽聽聽聽 <c:if test="${not ls.first}"></c:if>
聽聽 聽聽聽聽聽聽聽聽 <%rank++;%>
聽聽聽聽聽</c:forEach>
js涓簲鐢╦stl
if(${flag}=='0'){
聽聽聽window.parent.parent.frames('iframeTop').location.replace('../jsp/top.jsp');
聽聽}
浜孲TRUTS2鐨勬爣絳?br /><s:iterator value="hotNewsReviewList" status="status"聽 id="hotNewsReviewList">
聽聽聽聽聽聽聽聽聽聽 <li class="leftli"> <span class="leftbtxiao">鏃墮棿錛?lt;/span><s:property value="timeBuff"/><span class="leftbtxiao">銆銆銆濮撳悕錛?lt;/span> <s:property value="userName"/> </li>
聽聽聽聽聽聽聽聽聽聽 <li class="leftli">璇勮<span class="leftbtxiao">錛?lt;/span><s:property value="reviewContent" escape="false"/> </li>
聽聽聽聽聽聽</s:iterator>
<s:iterator value="kprList" status="status"聽 id="kprList">
<s:if test="#kprList.clickTotalCount!=null">
聽聽聽聽聽聽聽聽<s:property value="clickTotalCount"/>
聽聽聽聽聽聽聽</s:if>
</s:iterator>
<frameset rows="96,*" framespacing="0" frameborder="1" >
聽
聽
聽
聽
聽
</frameset>
聽
璁劇疆frameset涓殑frame澶у皬涓嶅彲璋冿紝浣跨敤frame鏍囩鐨?b>noresize="noresize"灞炴ф垨鐩存帴noresize,緙虹渷鏄厑璁歌皟鑺傚ぇ灝忕殑
<frameset rows="50%,50%">
聽
聽
聽
聽
聽
</frameset> 鍔熻兘錛?/span>榪斿洖欏跺眰紿楀彛錛屽嵆嫻忚鍣ㄧ獥鍙c?/p> 璇硶錛?/span>window.top 娉細濡傛灉紿楀彛鏈韓灝辨槸欏跺眰紿楀彛錛宼op灞炴ц繑鍥炵殑鏄鑷韓鐨勫紩鐢ㄣ?/p>
浜?閫夋嫨iframe浠ヤ笅鏄唬鐮佺墖孌?br />
<body style="background-image:url(images/background.bmp);background-repeat:repeat-x; background-color:#FFFFFF">
<table border="0" cellpadding="0" cellspacing="0" width="950" height="100%" align="center">
<tr>
聽<td width="950px" height="180"><iframe id="iframeTop" name="iframeTop" src="jsp/top.htm" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" width="950" height="100%"></iframe></td>
</tr>
<tr>
聽<td><iframe id="iframeCenter" name="iframeCenter" src="jsp/center.htm" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" width="950px"></iframe></td>
</tr>
<tr>
聽<td height="55px"><iframe id="iframeBottom" name="iframeBottom"" src="jsp/bottom.htm" scrolling="no" frameborder="0" marginwidth="0" marginheight="0" width="950px" height="55px"></iframe></td>
</tr>
</table>
</body>
</html>
scrolling="no"聽聽 鎰忔濇槸涓嶈兘鐨勪笅鎷夋
涓?Window top銆乸arent灞炴?
window.top
![]() |
鍔熻兘錛?/span>榪斿洖鐖剁獥鍙c?/p>
璇硶錛?/span>
window.parent
娉細濡傛灉紿楀彛鏈韓鏄《灞傜獥鍙o紝parent灞炴ц繑鍥炵殑鏄鑷韓鐨勫紩鐢ㄣ?/p>
鍦ㄦ鏋剁綉欏典腑錛屼竴鑸埗紿楀彛灝辨槸欏跺眰紿楀彛錛屼絾濡傛灉妗嗘灦涓繕鏈夋鏋訛紝鐖剁獥鍙e拰欏跺眰紿楀彛灝變笉涓瀹氱浉鍚屼簡銆?/p>
|
鍥?閲婃斁ie涓璞$殑鍐呭瓨
if(window.navigator.appName=='Microsoft Internet Explorer'){
聽聽obj.src = null;
聽聽CollectGarbage();//鐢ㄤ簬鍐呭瓨閲婃斁錛屽厛灝嗛渶瑕侀噴鏀劇殑瀵硅薄緗負絀?br />聽}
CollectGarbage,鏄疘E鐨勪竴涓壒鏈夊睘鎬?鐢ㄤ簬閲婃斁鍐呭瓨鐨勶紝浣跨敤鏂規硶鍢涘簲璇ユ槸,灝嗚鍙橀噺鎴栧紩鐢ㄥ璞?璁劇疆涓簄ull鎴杁elete錛岀劧鍚庡湪榪涜閲婃斁鍔ㄤ綔錛屽湪鍋欳ollectGarbage鍓?瑕佸繀闇娓呮鐨勪袱涓繀澶囨潯浠?
寮曠敤
- 涓涓璞″湪鍏剁敓瀛樼殑涓婁笅鏂囩幆澧冧箣澶栵紝鍗充細澶辨晥銆?br />- 涓涓叏灞鐨勫璞″湪娌℃湁琚墽鐢?寮曠敤)鐨勬儏鍐典笅錛屽嵆浼氬け鏁堛?br />
浜?寮瑰嚭涓涓〉闈?br />window.open('../six.html','main','top=0,left=0,width=465,height=620,status=no,toolbar=no,menubar=no,scrollbars=yes,resizable=no');
resizable=no灝辨槸涓嶈鐢ㄦ埛淇敼寮瑰嚭紿楀彛澶у皬
聽
鏂規涓:鐢╥frame鐨刵ame灞炴у畾浣?br />聽聽聽聽 <input type="button" name="Button" value="Button"
onclick="document.frames('ifrmname').location.reload()">
聽
鎴?br /><input type="button" name="Button" value="Button"
onclick="document.all.ifrmname.document.location.reload()">
聽
鏂規浜?鐢╥frame鐨刬d灞炴у畾浣?br /><input type="button" name="Button" value="Button"
onclick="ifrmid.window.location.reload()">
聽
緇堟瀬鏂規:褰搃frame鐨剆rc涓哄叾瀹冪綉绔欏湴鍧(璺ㄥ煙鎿嶄綔鏃?
<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">