JavaScript就这么回事 (JS基础知识整理)
JavaScript就这么回事 (JS基础知识整理)
1 创建脚本块
1: <script language=”JavaScript”>
2: JavaScript code goes
here
3: </script>
2 隐藏脚本代码
1: <script language=”JavaScript”>
2: <!–
3:
document.write(“Hello”);
4: // –>
5: </script>
在不支持JavaScript的浏览器中将不执行相关代码
3 浏览器不支持的时候显示
1: <noscript>
2: Hello to the non-JavaScript browser.
3:
</noscript>
4 链接外部脚本文件
1: <script language=”JavaScript”
src=”/”filename.js””></script>
5 注释脚本
1: // This is a comment
2: document.write(“Hello”); // This is a
comment
3: /*
4: All of this
5: is a comment
6: */
6 输出到浏览器
1: document.write(“<strong>Hello</strong>”);
7 定义变量
1: var myVariable = “some value”;
8 字符串相加
1: var myString = “String1” + “String2”;
9 字符串搜索
1: <script language=”JavaScript”>
2: <!–
3: var myVariable
= “Hello there”;
4: var therePlace = myVariable.search(“there”);
5:
document.write(therePlace);
6: // –>
7: </script>
10 字符串替换
1: thisVar.replace(“Monday”,”Friday”);
11 格式化字串
1: <script language=”JavaScript”>
2: <!–
3: var myVariable
= “Hello there”;
4: document.write(myVariable.big() +
“<br>”);
5: document.write(myVariable.blink() +
相关文档:
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server"> </script>
<html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server">
<title ......
// 保存Cookie
function saveCookie(name, value, expires, path, domain, secure){
var strCookie = name +& ......
事实上IE已经为我们内嵌了WebBrowser控件,已经能够很好的支持我们常用的打印功能了。通过该控件的功能调用,用户可以将当前的Html页面输出到打印机上,用户只需要将要打印的数据组织成Html页面,然后调用WebBrowser的打印功能就可以很好的实现所见即所得的打印功能。不过这种打印存在的缺点就是打印精度不够,如果需要精确 ......