⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 js_howto.asp@output=print

📁 W3Schools tutorial..web designing
💻 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>JavaScript How To</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>JavaScript How To ...</h1>
<a href="js_intro.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="js_whereto.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<p class="intro">The HTML &lt;script&gt; tag is used to insert a JavaScript into an HTML 
page.</p>
<hr />

<h2>Examples</h2>
<p><a target="_blank" href="tryit.asp@filename=tryjs_text">Write text with 
Javascript</a><br />
The example demonstrates how to use JavaSript to write text on a web page.</p>
<p><a target="_blank" href="tryit.asp@filename=tryjs_formattext">Write HTML with 
Javascript</a><br />
The example demonstrates how to use JavaScript to write HTML tags on a web page.</p>
<hr />

<h2>How to Put a JavaScript Into an HTML Page</h2>
<table width="100%" border="1" class="ex" cellspacing="0">
<tr><td>
<pre>&lt;html&gt;
&lt;body&gt;
<span class="insert">&lt;script type=&quot;text/javascript&quot;&gt;
document.write(&quot;Hello World!&quot;);
&lt;/script&gt;
</span>&lt;/body&gt;
&lt;/html&gt;</pre>
</td></tr>
</table>
<p>The code above will produce this output on an HTML page:</p>
<table width="100%" border="1" class="ex" cellspacing="0"><tr><td>
Hello World!
</td></tr></table>
<h3>Example Explained</h3>
<p>To insert a JavaScript into an HTML page, we use the &lt;script&gt; tag. 
Inside the &lt;script&gt; tag we 
use the &quot;type=&quot; 
attribute to define the scripting language.</p>
<p>So, the &lt;script type=&quot;text/javascript&quot;&gt; and &lt;/script&gt; tells where the 
JavaScript starts and ends:</p>
<table width="100%" border="1" class="ex" cellspacing="0"><tr><td>
<pre>&lt;html&gt;
&lt;body&gt;
<span class="insert">&lt;script type=&quot;text/javascript&quot;&gt;
...
&lt;/script&gt;
</span>&lt;/body&gt;
&lt;/html&gt;</pre>
</td></tr></table>
<p>The word <b>document.write</b> is a standard JavaScript command for writing output to a page.</p>
<p>By entering the document.write command between the &lt;script&gt; 
and &lt;/script&gt; tags, the browser will recognize it as a JavaScript command and 
execute the code line. In this case the browser will write Hello World! to the page:</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table1"><tr><td>
<pre>&lt;html&gt;
&lt;body&gt;
<span class="insert">&lt;script type=&quot;text/javascript&quot;&gt;
document.write(&quot;Hello World!&quot;);
&lt;/script&gt;
</span>&lt;/body&gt;
&lt;/html&gt;</pre>
</td></tr></table>
<p><a target="_blank" href="tryit.asp@filename=tryjs_text">Try it yourself.</a></p>
<p><b>Note:</b> If we had not entered the &lt;script&gt; tag, the browser would have 
treated the document.write(&quot;Hello World!&quot;) command as pure text, and just write the entire line on the page.</p>
<p><a target="_blank" href="tryit.asp@filename=tryjs_textx">Try it yourself.</a></p>
<hr />

<h2>HTML Comments to Handle Simple Browsers</h2>
<p>Browsers that do not support JavaScript will display JavaScript as page
content. </p>
<p>To prevent them from doing this, and as a part of the JavaScript standard, 
the HTML comment tag can be used to &quot;hide&quot; the JavaScript. Just add an HTML 
comment tag &lt;!-- before the first JavaScript statement, and a --&gt; (end of 
comment) after the last JavaScript statement.</p>
<table width="100%" border="1" class="ex" cellspacing="0" id="table2"><tr><td>
<pre>&lt;html&gt;
&lt;body&gt;<span class="insert">
&lt;script type=&quot;text/javascript&quot;&gt;
&lt;!--
document.write(&quot;Hello World!&quot;);
//--&gt;
&lt;/script&gt;
</span>&lt;/body&gt;
&lt;/html&gt;</pre>
</td></tr></table>
<p>The two forward slashes at the end of comment line (//) is the JavaScript comment symbol. 
This prevents JavaScript from executing the --&gt; tag.</p>
<hr />
<a href="js_intro.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="js_whereto.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 + -