JavaScript就这么回事 (JS基础知识整理)
1 创建脚本块
引用内容程序代码
<script language=”JavaScript”>
JavaScript 代码写在这里面
</script>
2 隐藏脚本代码
引用内容程序代码
<script language=”JavaScript”>
<!--
document.write(“Hello”);
// -->
</script>
在不支持JavaScript的浏览器中将不执行相关代码
3 浏览器不支持的时候显示
引用内容程序代码
<noscript>
Hello to the non-JavaScript browser.
</noscript>
4 链接外部脚本文件
引用内容程序代码
<script language=”JavaScript” src="/”filename.js"”></script>
5 注释脚本
引用内容程序代码
// This is a comment
document.write(“Hello”); // This is a comment
/*
All of this
is a comment
*/
6 输出到浏览器
引用内容程序代码
document.write(“<strong>Hello</strong>”);
7 定义变量
引用内容程序代码
var myVariable = “some value”;
8 字符串相加
引用内容程序代码
var myString = “String1” + “String2”;
9 字符串搜索
引用内容程序代码
<script language=”JavaScript”>
<!--
var myVariable = “Hello there”;
var therePlace = myVariable.search(“there”);
document.write(therePlace);
// -->
</script>
10 字符串替换
引用内容程序代码
thisVar.replace(“Monday”,”Friday”);
11 格式化字串
引用内容程序代码
<script language=”JavaScript”>
<!--
var myVariable = “Hello there”;
document.write(myVariable.big() + “<br>”);
document.write(myVariable.blink() + “<br>”);
document.write(myVariable.bold() + “<br>”);
document.write(myVariable.fixed() + “<br>”);
document.write(myVariable.fontcolor(“red”) + “<br>”);
document.write(myVariable.fontsize(“18pt”) + “<br>”);
document.write(myVariable.
相关文档:
css获取页面中心位置
.fixed
{
FONT-SIZE: 30pt;
color : #1A6841;
left:expression(eval(document.body.clientWidth)/2-150);
top:expression(eval(document.body.clientHeight)/2-25);
width:300px;
height:50px;
border:green 1px solid;
background:#99CCFF;
+position:absolute;
+left:expression(ev ......
向上:
<div id=demo style="overflow:hidden; width:128px; height:300px;">
<div id=demo1>
<img src="/gfjs.gif"><br><img src="/bxtt.gif"><br><img src="/bzjd.gif"><br>
<img src="/gfjs.gif"><br><img src="/bxtt.gif"><br><img ......
首先,在各个浏览器中,断点调试支持的最好的当然是Firefox,Firefox不仅可以使用Firebug调试页面js脚本,还可以用高级调试工具例如JavaScript Debugger (Venkman) 来调试Firefox扩展里的js。除此之外,Firefox还支持一些更为高级的断点调试、变量监视功能。
其他浏览器里,Opera、Chrome和Safari的调试功能也比较好用。 ......
本文是对《AJAX动态网页信息提取原理》
的补充,前文总结了两种AJAX网页文字的抓取方法:
网页文字在加载HTML文档(document)的时候用Javascript代码获取和展现,此Javascript代码在发送load事件之前运行,那么接收到load事件表示所有的内容都加载完了
网页文字在加载完HTML文档(document)后在某个时刻用Javascript ......