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

推荐订阅源

月光博客
月光博客
T
Troy Hunt's Blog
P
Proofpoint News Feed
H
Help Net Security
博客园 - 叶小钗
N
Netflix TechBlog - Medium
F
Full Disclosure
Vercel News
Vercel News
C
Cyber Attacks, Cyber Crime and Cyber Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
GbyAI
GbyAI
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Microsoft Azure Blog
Microsoft Azure Blog
博客园 - 【当耐特】
Martin Fowler
Martin Fowler
V
V2EX
Latest news
Latest news
L
LangChain Blog
The Register - Security
The Register - Security
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
Schneier on Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
N
News and Events Feed by Topic
M
MIT News - Artificial intelligence
Hacker News - Newest:
Hacker News - Newest: "LLM"
T
The Exploit Database - CXSecurity.com
Microsoft Security Blog
Microsoft Security Blog
S
Secure Thoughts
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Spread Privacy
Spread Privacy
S
Securelist
Forbes - Security
Forbes - Security
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
V
Vulnerabilities – Threatpost
MyScale Blog
MyScale Blog
G
Google Developers Blog
L
Lohrmann on Cybersecurity
博客园 - Franky
T
Tor Project blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
V
Visual Studio Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Google DeepMind News
Google DeepMind News
F
Fortinet All Blogs
Y
Y Combinator 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;
   
}