![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
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 · 247 阅读 · 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 · 1147 阅读 · 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 · 196 阅读 · 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 · 905 阅读 · 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 · 1097 阅读 · 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 · 107 阅读 · 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 · 522 阅读 · 0 评论