惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cisco Talos Blog
Cisco Talos Blog
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI
P
Proofpoint News Feed
T
The Blog of Author Tim Ferriss
云风的 BLOG
云风的 BLOG
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
B
Blog RSS Feed
Y
Y Combinator Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
Tailwind CSS Blog
AWS News Blog
AWS News Blog
Jina AI
Jina AI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Recorded Future
Recorded Future
NISL@THU
NISL@THU
N
Netflix TechBlog - Medium
雷峰网
雷峰网
Vercel News
Vercel News
Latest news
Latest news
S
Security @ Cisco Blogs
W
WeLiveSecurity
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Schneier on Security
Schneier on Security
IT之家
IT之家
Blog — PlanetScale
Blog — PlanetScale
L
Lohrmann on Cybersecurity
T
Tor Project blog
Hugging Face - Blog
Hugging Face - Blog
TaoSecurity Blog
TaoSecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
The Hacker News
The Hacker News
J
Java Code Geeks
美团技术团队
MyScale Blog
MyScale Blog
Google DeepMind News
Google DeepMind News
aimingoo的专栏
aimingoo的专栏
H
Hacker News: Front Page
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CERT Recently Published Vulnerability Notes
S
Secure Thoughts
Microsoft Security Blog
Microsoft Security Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
B
Blog
博客园 - 三生石上(FineUI控件)
The Register - Security
The Register - Security
G
Google Developers Blog
Webroot Blog
Webroot Blog

博客园 - ruinet

WCF通用服务请求类 使用MVP模式实现B/S和C/S平台的功能通用 WCF中使用扩展行为来验证连接的用户 Microsoft.Practices.Unity依赖注入使用实例 简洁的Asp.net菜单控件 Windows Mobile无线打印的实现 使用HTML,CSS快速导出数据到Excel 软件技术网站精选 CakePHP架构入门 升级Sql Server 2000到Sql Server 2005中要注意的问题 asp.net web开发综合技能 编写第一个Silverlight程序 Saas学习 在Windows Mobile上控制输入法 - ruinet - 博客园 在Windows Mobile创建桌面快捷方式 在仿真设备中使用主机网络 重启PocketPC移动设备 使用Ajax控件引发性能问题 智能移动项目打包发布经验交流
CSS,JavaSript,Html实用小代码
ruinet · 2007-11-16 · via 博客园 - ruinet

2007-11-16 16:07  ruinet  阅读(824)  评论()    收藏  举报

  一些使用的CSS,javascript ,html代码.

1 absoluterelative

Absolute :绝对定位

Relative :相对定位,参照于父级的原始点为原始点,无父级参照Body.

2 CSS中使用experssion定位

CSS中可以使用expression 来动态的设置对象格式,如宽度和高度

width:expression(documentElement.clientWidth >= 1000?1000:(documentElement.clientWidth <= 800? 800:auto));

3 CSS中使用clear 清除浮动

在使用float浮动对象在right left边时,但有不想后面的元素不被影响.这是需要使用clear:both;来清除

<p style="float:left;width:34px; border :solid 1px #000000;">这是第1列,</p>

<p style="float:left;width:50px; border :solid 1px #000000;">这是第2列,</p>

<p >这是列的下面。</p>

没有加clear:both;这是列的下面。将会和上面的在同一行上.

<p style="float:left;width:34px; border :solid 1px #000000;">这是asfd第1列,</p>

<p style="float:left;width:50px; border :solid 1px #000000;">这是dsf第2列,</p>

<p style="clear :both;">这是列的下面。</p>

将会在上面两段文字的下面

4.javacript实现回调

<script type ="text/javascript">
function funA(name,classback)
{
 this.Name=name;
 classback({name:this.Name,value:1234});
}

function btnClick(){
  funA("Test",function(v){
     alert(v.value);
  });
 }
</script>

<input type="button" value="btn" onclick="btnClick();">

5.javacript 获取控件位置

function getoffset(e) 

        
var t=e.offsetTop; 
        
var l=e.offsetLeft; 
        
while(e=e.offsetParent) 
        { 
            t
+=e.offsetTop; 
            l
+=e.offsetLeft; 
        } 
        
var rec = new Array(1); 
        
return {offsetTop:t,offsetLeft:l};

6.关闭IE6,7,8窗口不弹出提示

Code
function CloseWindow()
{
window.open(
'','_self','');
window.close();
}

7.使用CSS定位footer到页面底部

CSS

html

 8.CSS控制内容超出长度时显示...

 在CSS3.0中新增了属性:text-overflow设置文本溢出时的显示效果。IE6.0以上版本支持,支持div,li,p标签。

 div,li,p { 
   width
:50px; 
   white-space
:nowrap; 
   text-overflow
:ellipsis; 
   overflow
: hidden; 
   border
:solid 1px red;
   
}