??xml version="1.0" encoding="utf-8" standalone="yes"?>
1.QIE览器)q箋的英文字W和阿拉伯数?使用word-wrap : break-word ;或者word-break:break-all;实现强制断行 #wrap{word-break:break-all; width:200px;} <div id="wrap">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div> 效果Q可以实现换?/p>
2.QFirefox览器)q箋的英文字W和阿拉伯数字的断行,Firefox的所有版本的没有解决q个问题,我们只有让超界的字符隐藏或?l容器添加滚动条
<div id="wrap">abcdefghijklmnabcdefghijklmnabcdefghijklmn111111111</div> 效果Q容器正常,内容隐藏 对于table 1. (IE览?使用 table-layout:fixed;强制table的宽?多余内容隐藏 <table style="table-layout:fixed" width="200"> 效果Q隐藏多余内?/p>
2.(IE览?使用 table-layout:fixed;强制table的宽?内层td,th采用word-break : break-all;或者word-wrap : break-word ;换行 <table width="200" style="table-layout:fixed;"> 效果Q可以换?/p>
3. (IE览?在td,th中嵌套div,p{采用上面提到的div,p的换行方?/p>
4.(Firefox览?使用 table-layout:fixed;强制table的宽?内层td,th采用word-break : break-all;或者word-wrap : break-word ;换行Q用overflow:hidden;隐藏出内容Q这里overflow:auto;无法起作?/p>
效果Q隐藏多于内?/p>
5.(Firefox览? 在td,th中嵌套div,p{采用上面提到的对付Firefox的方?br />q行代码?br />最后,q种现象出现的几率很,但是不能排除|友的恶搞?/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 = "q就是所谓的动态创建!";
showdiv.style.height = "100px";
showdiv.style.backgroundColor = "yellow";
document.body.appendChild(showdiv);
}
</script>
<body>
<a href="javascript:show();">Ҏ</a>
</body>
</html>
前言Q与传统的方法不同,DOM作ؓ一U“手术刀”型的开发工兯够对document做到“细致入微”的照顾。因为DOM是基于文档树模型建立h的一套方法因此能够对文档做几乎Q何方面的修改。不论您是希望修改结构还是在内容Q用DOM都是一个不错的选择?br />今天要谈到到了是四个典型的DOMҎ以及他们的用策略:
createElement()Ҏ createTextNode()Ҏ appendChild()Ҏ insertBefore()Ҏ1.creatElement()Ҏ
规则document.creatElement(nodeName)
例如我们可以使用如下的语句来创徏一个段落?br />document.creatElement("p")
2.creatTextNode()Ҏ
规则document.creatTextNode(text)
例如我们可以使用如下语句来创Z条语句用来问候大家?br />document.creatTextNode("Hello World")
3.appendChild()Ҏ
规则parent.appendChild(child)
创徏了所需要的l构或内容以后还需要将所创徏的东西插入到文档当中才能成功。例如我们可以用如下的Ҏ来徏立v我们需要创建的HTML内容。请注意q完全是动态徏立的?br />var para = document.createElement("p");
var testdiv = document.getElementById("testdiv");
var txt = document.createTextNode("Hello World");
testdiv.appendChild(para);
para.appendChild(txt);
q样我们把之前所建立的结构与内容插如C我们所需要的地方。不q问题也随之而来QappendChild()Ҏ只能创徏已知元素l点的最后一个子l点Q如果当父元素已l拥有几个子元素的时候,我们是无法通过appendChild()Ҏ来选择插入点的?br />4.insertBefore()Ҏ
规则parentElement.inserBefore(newElemenet,targetElement)
在用的时候,我们不需要知道父元素到底是谁Q因为我们可以通过q样的语法获得父元素Q?br />targetElement.parentNode
q样看上M乎有点好W,当别人问你父亲是谁的时候,你却告诉别hQ我的父亲就是“我的父亜y。不q在DOM中,它确实就是一个能实际使用的方法?br />
补充一个有意义的函敎ͼ
当看到有insertBefore()Ҏ之后Q也怼惛_然的认ؓq有insertAfter()Ҏ。不q要让你失望了,DOMq没有提供这LҎ。我x因ؓ它可以通过混合使用insertBefore()Ҏ和appendChild()Ҏ来实现吧。但是,我们d望它能够是对U。所以我们自己动手编写一个insertAfter()ҎQ把它作为函数存攑֜我们的文档中?br />function insertAfter(newelElement,targetElement) {
var parent = targetElement.parentNode;
if (parent.lastChild == targetElement) {
parent.appendChild(newElement);
}else {
parent.insertBefore(newElement,targetElement.nextSibling);
}
}
xQ我们至能够用以上的几个DOMҎ来创建简单的HTML文档。用DOM的好处有两点Q第一Q文档与行ؓ互相分离Q这W合C工程学的先进理念。请时刻CQ合在一L永远都不是最好的办法。第二,动态创建的l构与内容ƈ不媄响原先的文档内容Q这样得我们能清楚的完成“替换”与“插入”的不同操作?br />是的DOM是q样一U细致的工具。细致而强大的是DOM能够在世界上成ؓ标准的有力条件?/font>
]]>
对于div,p{块U元?
正常文字的换?亚洲文字和非亚洲文字)元素拥有默认的white-space:normal,当定义的宽度之后自动换行
html
<div id="wrap">正常文字的换?亚洲文字和非亚洲文字)元素拥有默认的white-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>
xint 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中应用jstl
if(${flag}=='0'){
window.parent.parent.frames('iframeTop').location.replace('../jsp/top.jsp');
}
二STRUTS2的标{?br /><s:iterator value="hotNewsReviewList" status="status" id="hotNewsReviewList">
<li class="leftli"> <span class="leftbtxiao">旉Q?lt;/span><s:property value="timeBuff"/><span class="leftbtxiao"> 姓名Q?lt;/span> <s:property value="userName"/> </li>
<li class="leftli">评论<span class="leftbtxiao">Q?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> 功能Q?/span>q回层H口Q即览器窗口?/p> 语法Q?/span>window.top 注:如果H口本n是层H口Qtop属性返回的是对自n的引用?/p>
?选择iframe以下是代码片D?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、parent属?
window.top
![]() |
功能Q?/span>q回父窗口?/p>
语法Q?/span>
window.parent
注:如果H口本n是顶层窗口,parent属性返回的是对自n的引用?/p>
在框架网中Q一般父H口是层H口Q但如果框架中还有框Ӟ父窗口和层H口׃一定相同了?/p>
|
?释放ie中对象的内存
if(window.navigator.appName=='Microsoft Internet Explorer'){
obj.src = null;
CollectGarbage();//用于内存释放Q先需要释攄对象|ؓI?br /> }
CollectGarbage,是IE的一个特有属?用于释放内存的,使用Ҏ嘛应该是,该变量或引用对?讄为null或deleteQ然后在q行释放动作Q在做CollectGarbage?要必需清楚的两个必备条?
引用
- 一个对象在其生存的上下文环境之外,即会失效?br />- 一个全局的对象在没有被执?引用)的情况下Q即会失效?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是不让用户修改弹出H口大小
Ҏ一:用iframe的name属性定?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()">
Ҏ?用iframe的id属性定?br /><input type="button" name="Button" value="Button"
onclick="ifrmid.window.location.reload()">
l极Ҏ:当iframe的src为其它网站地址(跨域操作?
<input type="button" name="Button" value="Button"
onclick="window.open(document.all.ifrmname.src,'ifrmname','')">