📄 html_scripts.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>HTML Scripts</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>HTML Scripts</h1>
<a href="html_url.asp"><img border="0" src="../images/btn_previous.gif" width="100" height="20" alt="Previous" /></a>
<a href="html_standardattributes.asp"><img border="0" src="../images/btn_next.gif" width="100" height="20" alt="Next" /></a>
<hr />
<p class="intro">Add scripts to HTML pages to make them more dynamic and
interactive.</p>
<hr />
<h2>Examples</h2>
<p><a target="_blank" href="tryit.asp@filename=tryhtml_script">Insert a script</a><br />
This example demonstrates how to insert a script into your HTML document.</p>
<p><a target="_blank" href="tryit.asp@filename=tryhtml_noscript">Work with browsers that do not support scripts</a><br />
This example demonstrates how to handle browsers that do not support scripting.</p>
<hr />
<h2>Insert a Script into HTML Page</h2>
<p>A script in HTML is defined with the <script> tag. Note that you will
have to use the type attribute to specify the scripting language.</p>
<table width="100%" class="ex" cellspacing="0" border="1">
<tr>
<td>
<pre><html>
<head>
</head>
<body></pre>
<pre><script type="text/javascript">
document.write("Hello World!")
</script></pre>
<pre></body>
</html></pre>
</td>
</tr>
</table>
<p>The script above will produce this output:</p>
<p>Hello World!</p>
<p><b>Note:</b> To learn more about scripting in HTML, visit our <a href="../js/default.asp">JavaScript
School</a>.</p>
<hr />
<h2>How to Handle Older Browsers</h2>
<p>A browser that does not recognize the <script> tag at all, will display
the <script> tag's content as text on the page. To prevent the browser from
doing this, you should hide the script in comment tags. An old browser (that does not
recognize the <script> tag) will ignore the comment and it will not write
the tag's content on the page, while a new browser will understand that the
script should be executed, even if it is surrounded by comment tags.</p>
<h3>Example</h3>
<table class="ex" cellspacing="0" border="1" cellpadding="3" width="100%">
<tbody>
<tr>
<td valign="top"><b>JavaScript:</b><br />
<script type="text/javascript"><br />
<!--<br />
document.write("Hello World!")<br />
//--><br />
</script>
<p><b>VBScript:<br />
</b><script type="text/vbscript"><br />
<!--<br />
document.write("Hello World!")<br />
'--><br />
</script></p>
</td>
</tr>
</tbody>
</table>
<br />
<hr />
<h2>The <noscript> Tag</h2>
<p>In addition to hiding the script inside a comment, you can also add a <noscript>
tag.</p>
<p>The <noscript> tag is used to define an alternate text if a
script is NOT executed. This tag is used for browsers that recognize the
<script> tag, but do not support the script inside, so these browsers will
display the text inside the <noscript> tag instead. However, if a browser supports
the script inside the <script> tag it will ignore the <noscript>
tag.</p>
<h3>Example</h3>
<table class="ex" cellspacing="0" border="1" cellpadding="3" width="100%">
<tbody>
<tr>
<td valign="top"><b>JavaScript:</b><br />
<script type="text/javascript"><br />
<!--<br />
document.write("Hello World!")<br />
//--><br />
</script><br />
<noscript>Your browser does not support
JavaScript!</noscript>
<p><b>VBScript:<br />
</b><script type="text/vbscript"><br />
<!--<br />
document.write("Hello World!")<br />
'--><br />
</script><br />
<noscript>Your browser does not support VBScript!</noscript></p>
</td>
</tr>
</tbody>
</table>
<br />
<hr />
<h2>Script Tags</h2>
<table class="ex" cellspacing="0" border="1" width="100%">
<tr>
<th align="left" valign="top">Tag</th>
<th align="left">Description</th>
</tr>
<tr>
<td valign="top"><a href="../tags/tag_script.asp"><script></a></td>
<td>Defines a script</td>
</tr>
<tr>
<td valign="top"><a href="../tags/tag_noscript.asp"><noscript></a></td>
<td>Defines an alternate text if the script is not executed</td>
</tr>
<tr>
<td valign="top"><a href="../tags/tag_object.asp"><object></a></td>
<td>Defines an embedded object</td>
</tr>
<tr>
<td valign="top"><a href="../tags/tag_param.asp"><param></a></td>
<td>Defines run-time settings (parameters) for an object</td>
</tr>
<tr>
<td valign="top"><a href="../tags/tag_applet.asp"><applet></a></td>
<td class="deprecated">Deprecated. Use <object> instead</td>
</tr>
</table>
<br /><hr />
<a href="html_url.asp"><img border="0" src="../images/btn_previous.gif" width="100" height="20" alt="Previous" /></a>
<a href="html_standardattributes.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 + -