`
810364804
  • 浏览: 787084 次
文章分类
社区版块
存档分类
最新评论

JavaScript 简介

 
阅读更多

JavaScript 是世界上最流行的编程语言。

JavaScript 是脚本语言,它的主要功能有:

1、JavaScript:写入 HTML 输出

document.write("<h1>This is a heading</h1>");
document.write("<p>This is a paragraph</p>");

2、JavaScript:对事件作出反应

<button type="button" onclick="alert('Welcome!')">点击这里</button>

3、JavaScript:改变 HTML 内容

x=document.getElementById("demo") //查找元素
x.innerHTML="Hello JavaScript"; //改变内容

4、JavaScript:改变 HTML 样式

x=document.getElementById("demo") //找到元素
x.style.color="#ff0000"; //改变样式

5、JavaScript:验证输入

if isNaN(x) {alert("Not Numeric")};

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics