javaScript的语法

来源:互联网 发布:ubuntu文档 编辑:程序博客网 时间:2024/06/06 06:49

1.没有int char等类型,统一用var

<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title><script type="text/javascript">var a;a=1;document.write(a);</script></head><body></body></html>

2.函数:

<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title><script type="text/javascript">function show(a){document.write(a);}show(1);</script></head><body></body></html>

3.对象:

<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Insert title here</title><script type="text/javascript">var x=new Object();//Object第一个字母注意大写x.name=6;function show(a){alert(a);}show(x.name)</script></head><body></body></html>


1 0