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

推荐订阅源

F
Fortinet All Blogs
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
WordPress大学
WordPress大学
T
Tailwind CSS Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
S
Secure Thoughts
博客园 - 【当耐特】
Know Your Adversary
Know Your Adversary
NISL@THU
NISL@THU
博客园 - 司徒正美
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
P
Privacy & Cybersecurity Law Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
B
Blog
The GitHub Blog
The GitHub Blog
小众软件
小众软件
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
Martin Fowler
Martin Fowler
博客园 - 叶小钗
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tenable Blog
S
Securelist
博客园 - 三生石上(FineUI控件)
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Microsoft Security Blog
Microsoft Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
罗磊的独立博客
T
Threat Research - Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
Cloudbric
Cloudbric
The Cloudflare Blog
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
Microsoft Azure Blog
Microsoft Azure Blog
H
Hacker News: Front Page
腾讯CDC
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
V2EX - 技术
V2EX - 技术
GbyAI
GbyAI
TaoSecurity Blog
TaoSecurity Blog
I
Intezer
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
Google Online Security Blog
Google Online Security Blog
T
The Blog of Author Tim Ferriss

博客园 - 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;
   
}