CSS注意事项有哪些
在使用CSS应该尽量避免使用哪些技术?下面yjbys小编为大家整理使用CSS的注意事项,希望对大家学习CSS语言有帮助!
Internet Explorer Behaviors
它是什么?Internet Explorer 5 引入了行为 (behaviors)。behaviors 是一种通过使用 CSS 向 HTML 元素添加行为的方法。
为什么要避免它?只有 Internet Explorer 支持 behavior 属性。
用什么代替?请使用 JavaScript 和 HTML DOM 取而代之。
例子 1 - Mouseover Highlight
下面的. HTML 文件中有一个 <style> 元素,它为 <h1> 元素定义了一个行为:
<html>
<head>
<style type="text/css">
h1 { behavior: url() }
</style>
</head>
<body>
<h1>Mouse over me!!!</h1>
</body>
</html>
下面是 XML 文档 "":
<attach for="element" event="onmouseover" handler="hig_lite" />
<attach for="element" event="onmouseout" handler="low_lite" />
<script type="text/javascript">
function hig_lite()
{
r='red';
}
function low_lite()
{
r='blue';
}
</script>
behavior 文件包含了针对元素的 JavaScript 和 事件句柄。
如果您使用 Internet Explorer,可以亲自试一下(把鼠标放在例子中的文本上)。
例子 2 - Typewriter Simulation
下面的 HTML 文件中有一个 <style> 元素,它为 id 为 "typing" 的元素定义了一个行为:
<html>
<head>
<style type="text/css">
#typing
{
behavior:url(behave_);
font-family:'courier new';
}
</style>
</head>
<body>
<span id="typing" speed="100">IE5 introduced DHTML behaviors.
Behaviors are a way to add DHTML functionality to HTML elements
with the ease of CSS.<br /><br />How do behaviors work?<br />
By using XML we can link behaviors to any element in a web page
and manipulate that element.</p>
</span>
</body>
</html>
下面是 XML 文档 "":
<attach for="window" event="onload" handler="beginTyping" />
<method name="type" />
<script type="text/javascript">
var i,text1,text2,textLength,t;
function beginTyping()
{
i=0;
text1=rText;
textLength=th;
rText="";
text2="";
t=nterval(+"()",speed);
}
function type()
{
text2=text2+tring(i,i+1);
rText=text2;
i=i+1;
if (i==textLength)
{
clearInterval(t);
}
}
</script>
-
如何理解Javascript的caller,callee,call,apply区别
在提到上述的概念之前,首先想说说javascript中函数的隐含参数:argumentsarguments该对象代表正在执行的函数和调用它的函数的参数。[function.]arguments[n]参数function:选项。当前正在执行的Function对象的名字。n:选项。要传递给Function对象的从0开始的参数值...
-
javascript中的return和闭包函数
复制代码代码如下:functionmakefunc(x){returnfunction(){returnx;}}alert(makefunc(0));其实不是不执行,只是朋友的意思这里alert出来的`应该是“0”,而不是function(){returnx;}。不是脚本写错了,只是没搞懂return,从当前函数退出,并从那个函数返回一个值。如果返...
-
在PHP中利用XML技术构造远程服务
未来的Web将是以服务为中心的Web,XML_RPC标准使得编写和应用服务变得非常简单。本文介绍XML_RPC标准及其PHP实现,并通过实例示范了如何在PHP中开发XML_RPC服务和客户程序。一、服务式Web从内容提供商所采用的简单方法到UDDI(UniversalDescription,DiscoveryandInte...
-
asp.net 操作INI文件读写类实例代码
操作INI文件读写类实例代码复制代码代码如下:usingSystem;usingropServices;using;using;namespaceCommon{//////INI文件读写类。///publicclassINIFile{publicstringpath;publicINIFile(stringINIPath){path=INIPath;}[DllImport("kernel32")]privatestaticex...