📄 dhtml_css.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>DHTML Cascading Style Sheet</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>DHTML CSS</h1>
<a href="dhtml_events.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dhtml_summary.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<div id="d5">
<p class="intro">JavaScript can be used to change the style an HTML
element:</p>
<p><input type="button" onclick="document.getElementById('d5').style.backgroundColor='lightgrey'"
value="Click to change the background color" /></p>
</div>
<hr />
<h2>Examples</h2>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_dom_color">Change the
style of the current element</a><br />
How to change the style of an element using the <b>this</b> object.</p>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_dom_color2">Change the
style of a specific element</a><br />
How to change the style of an element using <b>getElementById</b>.</p>
<p>(You can find more examples at the bottom of this page)</p>
<hr />
<h2>JavaScript, DOM, and CSS</h2>
<p>With HTML 4, JavaScript and the HTML DOM can be used to change the style any HTML
element.<br>
<br>
To change the style the current HTML element, use the statement:<br>
<br>
style.<i>property</i>=<i>new style</i></p>
<p>or more correctly:</p>
<p>this.style.<i>property</i>=<i>new style</i></p>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_dom_color">Try it
yourself</a></p>
<p>To change the style of a specific HTML element, use the statement:<br>
<br>
document.getElementById(<i>element_id</i>).style.<i>property</i>=<i>new style</i></p>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_dom_color2">Try it
yourself</a></p>
<hr />
<h2>More examples</h2>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_event_onmouse">Mouse
Events</a><br />
How to change the color of an element when the cursor moves over it.</p>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_visibility">Visibility</a><br />
How to make an element invisible. Do you want the element to show or not?</p>
<hr />
<h2>More About JavaScript, DOM, And CSS</h2>
<p>For a full overview please refer to the complete
<a href="../htmldom/dom_obj_style.asp">DOM Style Object Reference</a> in our HTML
DOM tutorial.</p>
<p>To learn more about CSS, find the complete CSS tutorial on our
<a href="../default.asp">Home Page</a>.</p>
<hr />
<a href="dhtml_events.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dhtml_summary.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></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 + -