当前位置:亘古 » CSS
由 [ ] 于 [ 2011年07月04日 12:12 ] 发表在 [ 只是博文 ]

今天,闲来没事,就到订阅的BLOG去逛了逛,当逛到陈成的博客时,发现一个好东东,呵呵。下面就是言冬发现的好东东“CSS 溢出检测脚本”了。

使用很简单,只要在地址栏运行以下脚本即可。

文本+图片

1
javascript:(function(){var f=[],h=document;(function(n){var p=arguments.callee,l=n.childNodes,m=0,k=l.length;for(;m<k;m++){var o=l[m];if(o.nodeType===1){p(o)}else{if(o.nodeType===3){f.push(o)}}}})(h.body);for(var d=0;d<f.length;d++){var b=f[d],j=b.nodeValue.replace(/^\s+|\s+$/g,""),c=h.createTextNode(j);if(j!==""&&j.length!==1){b.parentNode.insertBefore(c,b)}}var g=document.images,a=0,e=g.length;for(;a<e;a++){g[a].src="http://www.yoobao.com/shoppic/2010410425118938.jpg"}})();

只文本

1
javascript:(function(){var list=[],doc=document;(function(parent){var func=arguments.callee,nodes=parent.childNodes,i=0,len=nodes.length;for(;i<len;i++){var node=nodes[i];if(node.nodeType===1){func(node);}else if(node.nodeType===3){list.push(node);}}})(doc.body);for(var i=0;i<list.length;i++){var node=list[i],value=node.nodeValue.replace(/^\s+|\s+$/g,''),tmpNode=doc.createTextNode(value);if(value!==''&&value.length!==1){node.parentNode.insertBefore(tmpNode,node);}}})();

只图片

1
javascript:(function(){var images=document.images,n=0,len=images.length;for(;n<len;n++){images[n].src='http://www.yoobao.com/shoppic/2010410425118938.jpg';}})();

最后,友情提示下:

此工具不可滥用,并非所有地方都要考虑溢出的扩展性。

原文地址:http://www.chencheng.org/blog/archives/css-overflow-test-script.html

标签 : [ , , , , ]
由 [ ] 于 [ 2011年06月30日 23:11 ] 发表在 [ 只是博文 ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<!DOCTYPE html>
<html dir="ltr" lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>这是一个测试</title>
<style>
*{
padding:0;
margin:0;
}
#main{
top:50%;
left:50%;
margin:-300px 0 0 -250px;
position:absolute;
}
#main h1{
text-indent:-9999em;
border-bottom:none;
}
#main h1 a,#main h1 a:visited{
height:600px;
width:500px;
background:#fff url(***.***) no-repeat;
display:block;
}
</style>
</head>
<body>
<div id="main">
<h1><a href="#" onclick="return false" title="?????">?????</a></h1>
</div>
</body>
</html>
标签 : [ , , ]