code, software architect, articles and novels. 代码,软件架构,博客和小说
1.learning Javascript--第一天
Posted onEdited onWord count in article: 3kReading time ≈3 mins.
在 javaSript 的注释中的语句只有在支持 javaScript 的浏览器上才能显现
不支持的浏览器要使用
一旦使用则语句块不能再被使用.调用的是 sa.js
这是两种定义字符串的方式
1 2
var value1 = "100"; var value2 = "kill you";
这是两种定义字符串的方式
1 2 3 4 5 6 7
var value5 = " world"; var value6 = (value5+value2).search("k"); var value7 = (value5+value2).replace("k",'c');
document.writeln(value6);这里得到6 document.writeln(value7);这里得到worldcill you
下面是一些常用的函数
big: Returns the string in big tags
blink: Returns the string in blink tags
bold: Returns the string in b tags
fixed: Returns the string in tt tags (for fixed-width display)
fontcolor: Returns the string in font tags with the color
attribute set to the color you specify as an argument
fontsize: Returns the string in font tags with the size attribute
set to the size you specify as an argument
italics: Returns the string in i tags
small: Returns the string in small tags
strike: Returns the string in strike tags (for a strikethrough
effect)
sub: Returns the string in sub tags (for a subscript effect)
sup: Returns the string in sup tags (for a superscript effect)
toLowerCase: Returns the string with all lowercase characters
toUpperCase: Returns the string with all upper case characters
<bodyonLoad="warning();"> <script> var ok = firm(); ... </script> 这里竟然先调用firm() 而后调用warning(); window.setTimeout("firm()",5000);5秒后自动跳出confirm对话框 function hello() { window.alert(“Hello”); window.setTimeout(“hello()”,5000); } 这个每隔5秒的跳出confirm var a = window.setTimeout("firm()",3000); window.clearTimeout(a);用于取消时间调度