📄 css_dont.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Don't</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>CSS Don't</h1>
<a href="css_mediatypes.asp"><img border="0" src="../images/btn_previous.gif" alt="Previous" /></a>
<a href="css_summary.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>
<hr />
<p class="intro">Here are some technologies you should try to avoid when
using CSS.</p>
<hr />
<h2>Internet Explorer Behaviors</h2>
<p><b>What is it? </b>Internet Explorer 5 introduced behaviors. Behaviors are a
way to add behaviors to HTML elements with the use of CSS styles.</p>
<p><b>Why avoid it?</b> The behavior attribute is only supported by Internet Explorer.</p>
<p><b>What to use instead? </b>Use JavaScript and
<a href="../htmldom/dom_obj_style.asp">HTML DOM</a> instead.</p>
<hr />
<h2>Example 1 - Mouseover Highlight</h2>
<p>The following HTML file has a <style> element that defines a behavior for the <h1>
element:</p>
<table border="1" width="100%" class="ex" cellspacing="0" id="table11">
<tr><td width="100%">
<pre><html>
<head>
<style type="text/css">
h1 { behavior: url(behave.htc) }
</style>
</head>
<body>
<h1>Mouse over me!!!</h1>
</body>
</html></pre>
</td></tr></table>
<p>The XML document "behave.htc" is shown below:</p>
<table border="1" width="100%" class="ex" cellspacing="0" id="table12">
<tr><td width="100%">
<pre><attach for="element" event="onmouseover" handler="hig_lite" />
<attach for="element" event="onmouseout" handler="low_lite" />
<script type="text/javascript">
function hig_lite()
{
element.style.color='red';
}</pre>
<pre>function low_lite()
{
element.style.color='blue';
}
</script></pre>
</td></tr></table>
<p>The behavior file contains a JavaScript and event
handlers for the elements.</p>
<p>If you use Internet Explorer, <a target="_blank" href="tryit.asp@filename=behave">try it yourself</a> (mouse over the text
in the example).</p>
<h2>Example 2 - Typewriter Simulation</h2>
<p>The following HTML file has a <style> element that defines a behavior
for elements with an id of "typing":</p>
<table border="1" width="100%" class="ex" cellspacing="0" id="table13">
<tr><td width="100%">
<pre><html>
<head>
<style type="text/css">
#typing
{
behavior:url(behave_typing.htc);
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></pre>
</td></tr></table>
<p>The XML document "typing.htc" is shown below:</p>
<table border="1" width="100%" class="ex" cellspacing="0" id="table14">
<tr><td width="100%">
<pre><attach for="window" event="onload" handler="beginTyping" />
<method name="type" /></pre>
<pre><script type="text/javascript">
var i,text1,text2,textLength,t;</pre>
<pre>function beginTyping()
{
i=0;
text1=element.innerText;
textLength=text1.length;
element.innerText="";
text2="";
t=window.setInterval(element.id+".type()",speed);
}</pre>
<pre>function type()
{
text2=text2+text1.substring(i,i+1);
element.innerText=text2;
i=i+1;
if (i==textLength)
{
clearInterval(t);
}
}
</script></pre>
</td></tr></table>
<p>If you use Internet Explorer,
<a target="_blank" href="tryit.asp@filename=behave_typing">try it yourself</a>.</p>
<hr />
<a href="css_mediatypes.asp"><img border="0" src="../images/btn_previous.gif" width="100" height="20" alt="Previous" /></a>
<a href="css_summary.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -