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

推荐订阅源

W
WeLiveSecurity
T
Troy Hunt's Blog
S
Schneier on Security
C
Cybersecurity and Infrastructure Security Agency CISA
C
CXSECURITY Database RSS Feed - CXSecurity.com
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Security Latest
Security Latest
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
MyScale Blog
MyScale Blog
Recorded Future
Recorded Future
A
About on SuperTechFans
PCI Perspectives
PCI Perspectives
H
Help Net Security
量子位
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
S
Security @ Cisco Blogs
The Hacker News
The Hacker News
P
Privacy International News Feed
Hacker News: Ask HN
Hacker News: Ask HN
阮一峰的网络日志
阮一峰的网络日志
博客园_首页
N
Netflix TechBlog - Medium
N
News and Events Feed by Topic
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Threatpost
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Simon Willison's Weblog
Simon Willison's Weblog
有赞技术团队
有赞技术团队
博客园 - 司徒正美
J
Java Code Geeks
S
Securelist
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 叶小钗
S
Secure Thoughts
Latest news
Latest news
S
Security Affairs
T
The Exploit Database - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
I
Intezer
雷峰网
雷峰网
Hacker News - Newest:
Hacker News - Newest: "LLM"
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org

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