JavaScript
6-Tong
a super student in BUPT!
展开
-
对象创建方法 & Date()
<html> <body> <h1>使用 new Object()创建一个对象</h1> <p id="demo"></p> <script> // definition1 : 创建一个person 对象 var person = new Object(); person.age = 18; person.name = "Ethan"; document.getElemen.原创 2021-12-18 00:05:58 · 215 阅读 · 0 评论 -
JavaScript DOM 基本操作:appendChild() & removeChild()&getElementsByTagName(“p“)
<html> <body> <h1>用DOM 增加一个 paragraph</h1> <div id="demo"> <p id="p1">this is the paragraph to be removed</p> <button onclick="myFunction()" id="button">remove</button> </div> <.原创 2021-12-17 01:28:46 · 1120 阅读 · 0 评论 -
html test
<!DOCTYPE html> <html> <head> <title>My document</title> </head> <body> <h1>my HTML document</h1> <p>this is a <i>test</i></p> </body> </html>原创 2021-12-16 23:32:01 · 156 阅读 · 0 评论 -
JavaScript Extensible Attributes 常用匹配方法
<html> <body> <script> // \d 查找数字: var pattern1 = /\d{2,4}/;// 检查字符串中 是否含有的2-4位的数字(非连续的也可以) var string1 = "2 wy66"; document.write(pattern1.test(string1)+"<br>"); var string2 = "wy3x3"; var pattern2 = /.原创 2021-12-17 00:29:19 · 877 阅读 · 0 评论 -
JavaScript 正则exec() test()的用法
<html> <body> <script> var pattern = /Java/g; var text = "JavaScript is more fun than Java" var result; while((result = pattern.exec(text))!= null) { //document.write("result: "+result+"<br>"); document.w.原创 2021-12-16 23:53:57 · 1084 阅读 · 0 评论 -
Document Scripting
<!DOCTYPE html> <html> <body> <div id="myDiv"> <p>the first paragraph</p> <p>the second paragraph</p> <p>the third paragraph</p> </div> <p>click the button to see...原创 2021-12-16 23:45:37 · 82 阅读 · 0 评论 -
JavaScript 读入
<html> <body> <script> var name = prompt("please enter your name:"); var number = prompt("please enter your student id"); document.write("the name is " + name + "<br>"); document.write("the student number is " + numb.原创 2021-12-13 22:17:49 · 504 阅读 · 0 评论