firefox与IE兼容javascript和CSS
css:
1.
ul标签中FF中有个padding值,却没有margin值,而在IE中正好相反
解决办法:将ul的padding和margin都设为0(也可以不是0)如:padding:0;margin:0;list-style:none;
另外form默认在IE中也会有margin值,所以最好也将其margin和padding设为0
2.
ie中cursor:hand可以将鼠标设为手形,FF不行,
解决:都用cursor:pointer
3、居中问题
ie需要将父窗口:text-align:center;而ff则是margin-left:auto;margin-right:auto;
4.IE和FF盒模型有区别,所以有需要特殊设置
IE Box的总宽度是: width+padding+border+margin宽度总和
FF Box的总宽度就是 width的宽度,padding+border+margin的宽度不含在width内。
FF: 支持 !important(优先解析), IE 则忽略, 可用 !important 为 FF 特别设置样式
width:600px !important;//这个要放在前面才行
width:598px;
另外:传说IE7会奇怪的支持!important,试过却不行;
5.
IE6中在设置float的div中margin会加倍,解决办法:div里面加上display:inline;
6.透明滤镜:
IE:filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=30);
FF:opacity:0.3;
或者:
IE:filter:alpha(opacity=60);
FF:-moz-opacity:0.6;/*已过时,用上面的opacity代替*/
7.禁用选择
IE:使用js,onselectstart="return false;";
FF:使用CSS,-moz-user-select:none;
8:圆角:
FF中:-moz-border-radius:4px;
js:
1.
IE中innerText在FF中没有,使用textContent;
eg:
var obj=document.getElementById("_td");
var text;
if(obj.innerText) {
text=obj.innerText;
} else if(obj.textContent) {
text=obj.textContent;
}
(DHTML手册说innerText不能用在tr,td等节点上,不过我之前明明用过的,然后
相关文档:
使用JavaScript可以将用户导向一个特定的地址,并且不同的方法会对浏览器的历史记录有不同的影响。
实例JavaScript代码
本例定义了两个JavaScript函数,功能都是重定向到首页,但是第一个函数采用的是直接给href赋值的方式,第二个使用的是replace方法。具体请看下面的代码:
<script type="text/javascript"> fun ......
在做B/S项目开发时。难免会遇到网页打印问题!
本人在网络上搜集 的一些资料拱 大家使用!yzitw.com №网络剑客→ 搜集
可以用css控制,看孟老大写的。
@media print
.a {display:block}
.b {display:hidden}
好像是这样。把你不想打印的部分class设为b
首先在网页中添加:
&n ......
<head>
</head>
<body>
<script type="text/javascript"><!--
function donativeapp()
{
if(arguments.length!=1)
{
return ;
}
try
{
var path=arguments[0];
var obj = new ActiveXObject("wscript.shell");
obj.Run(path);
obj=null;
}catch(e ......
来自:http://www.tripwiremagazine.com/tools/developer-toolbox/top-10-javascript-frameworks-by-google.html
Wed, Nov 11, 2009
Development
, Javascript
, Tools
JavaScript – an indispensable part for developing websites and web
pages, whether th ......
变量的主要作用是存取数据、提供存放信息的容器。对于变量必须明确变量的命名、变量的类型、变量的声明及变量的作用域。
变量的命名
JavaScript中的变量命名同其它计算机语言非常相似,这里要注意以下两点:
&nbs ......