2008年8月27日 星期三

control logic ( if & switch)

switch , case, break , default:
the same as C syntax

if , else :
the same as C syntax

comment

single line: //

multiple lines: /* and */

2008年8月14日 星期四

prompt


let user enter data
ex:
prompt("what is your name",  "insert name here");


import javascript into html

<script type="text/javascript"  src="test.js"> </script>

body's event

onload:
when page is loaded

onresize:
when browser is resized

style object

each element of web page has a style object

style.height:

style.width:

document object

document.body.clientHeigth:
client window height

document.body.clientWidth:
client window width

document.getElementById("elementName")

document.cookie:
set cookie:
ex:
document.cookie="name1=peter;expires=1/1/2000;";

how to clear cookie:
set it value to "" & expiration data to -1