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() +
相关文档:
父窗口中有三种方式打开子窗口:
1:
window.open(URL,windowName,parameters);
2:
alert(""); //弹出信息提示对话框
confirm(""); //弹出信息确认对话框
prompt(""); //具有交互性质的对话框
3:
//创建模态你对话框
window.showModalDialog(sURL,vArguments,sFeatures)
//创建非模态对话框
window.showM ......
Marquee图片无缝滚动关键词: Marquee
先了解一下 ......
JavaScript是一个功能强大的客户端脚本语言,许多现代化的网站和Web应用程序都会使用到它。JavaScript可以增强用户的体验,并提供丰富的互动式组件和功能。虽然它的语法相当简单,但是对开发者来说还是很有难度的,因为它要运行在Web浏览器中。
以下是我们为你推荐的50个相关工具:
JavaScript/AJAX编辑工具
jQuery UI
j ......
一般我們寫Notes For Web 程式時很長用到URL傳遞一些資訊,在Release 6 多支援了@UrlQueryString的公司來直接抓取URL參數,真是好用的公式阿.不過使用這個當然還是吃Server的資源(效能),能用 JavaScript ......