📄 dhtml_javascript.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 JavaScript</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 JavaScript</h1>
<a href="dhtml_intro.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dhtml_dom.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">JavaScript can create dynamic HTML content:</p>
<p class="intro">Date:
<script type="text/javascript">
document.write(Date());
</script>
</p>
<hr />
<h2>JavaScript Alone<br />
</h2>
<p>If you have studied JavaScript, you already know that the statement:</p>
<p><b>document.write()</b></p>
<p>can be used to display dynamic content to a web page.</p>
<h3>Example</h3>
<p>Using JavaScript to display the current date:</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table1"><tr><td>
<pre><html>
<body>
<script type="text/javascript">
document.write(Date());
</script>
</body>
</html></pre>
</td></tr></table>
<p><a target="_blank" href="tryit.asp@filename=trydhtml_date">Try it Yourself</a></p>
<hr />
<h2>JavaScript and the HTML DOM</h2>
<p>With HTML 4, JavaScript can also be used to change the inner content and
attributes of HTML elements dynamically.</p>
<p>To change the content of an HTML element use:</p>
<p><b>document.getElementById(<i>id</i>).innerHTML</b>=<b><i>new HTML</i></b></p>
<p>To change the attribute of an HTML element use: </p>
<p><b>document.getElementById(<i>id</i>).<i>attribute=new value</i></b></p>
<p>You will learn more about JavaScript and the HTML DOM in the next chapter of
this tutorial.</p>
<hr />
<h2>JavaScript and HTML Events</h2>
<p>New to HTML 4 is the ability to let HTML events trigger actions in the
browser, like starting a JavaScript when a user clicks on an HTML element.</p>
<p>To execute code when a user clicks on an element, use the following event
attribute:</p>
<p><b>onclick=<i>JavaScript</i></b></p>
<p>You will learn more about JavaScript and HTML Events in a later chapter.</p>
<hr />
<h2>JavaScript and CSS</h2>
<p>With HTML 4, JavaScript can also be used to change the style of HTML
elements.</p>
<p>To change the style of an HTML element use:</p>
<p><b>document.getElementById(<i>id</i>).style.<i>property</i></b>=<i><b>new style</b></i></p>
<p>You will learn more about JavaScript and CSS in a later chapter of this
tutorial.</p>
<hr />
<a href="dhtml_intro.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="dhtml_dom.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 + -