<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <script>
var carname1="Volvo XC60";
var carname2='Volvo XC60';
var answer1='It\'s alright';
var answer2="He is called \"Johnny\"";
var answer3='He is called "Johnny"';
document.write(carname1 + "<br>")
document.write(carname2 + "<br>")
document.write(answer1 + "<br>")
document.write(answer2 + "<br>")
document.write(answer3 + "<br>")
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <script>
var txt = "Hello World!";
document.write("<p>" + txt.length + "</p>");
var txt="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
document.write("<p>" + txt.length + "</p>");
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <p id="p1">Click the button to locate where "locate" first occurs.</p>
<p id="p2">0</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var str=document.getElementById("p1").innerHTML;
var n=str.indexOf("locate");
document.getElementById("p2").innerHTML=n+1;
}
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <script>
var str="Hello world!";
document.write(str.match("world") + "<br>");
document.write(str.match("World") + "<br>");
document.write(str.match("world!"));
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <p>替换 "Microsoft" 为 "Runoob" :</p>
<button onclick="myFunction()">点我</button>
<p id="demo">请访问 Microsoft!</p>
<script>
function myFunction() {
var str = document.getElementById("demo").innerHTML;
var txt = str.replace("Microsoft","Runoob");
document.getElementById("demo").innerHTML = txt;
}
</script> </body>
</html>

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
</head>
<body> <p id="demo">单击按钮显示数组。</p>
<button onclick="myFunction()">点我</button>
<script>
function myFunction(){
var str="a,b,c,d,e,f";
var n=str.split(",");
document.getElementById("demo").innerHTML=n[0];
}
</script> </body>
</html>

吴裕雄--天生自然 JAVASCRIPT开发学习:(String) 对象的更多相关文章

  1. 吴裕雄--天生自然 JAVASCRIPT开发学习:对象 实例(2)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  2. 吴裕雄--天生自然 JAVASCRIPT开发学习:对象

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  3. 吴裕雄--天生自然 JAVASCRIPT开发学习:对象 实例(3)

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  4. 吴裕雄--天生自然 JAVASCRIPT开发学习:条件语句

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  5. 吴裕雄--天生自然 JAVASCRIPT开发学习:字符串

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  6. 吴裕雄--天生自然 JAVASCRIPT开发学习

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  7. 吴裕雄--天生自然 JAVASCRIPT开发学习:函数定义

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  8. 吴裕雄--天生自然 JAVASCRIPT开发学习: this 关键字

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...

  9. 吴裕雄--天生自然 JAVASCRIPT开发学习: 表单

    <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script> ...

随机推荐

  1. 嵊州普及Day1T2

    题意:走迷宫.求走到a[n][n]需要多久. 考场上想的dfs,听老师说最多50分.代码懒得码了,知道是走迷宫就好. 正解:bfs,时间复杂度O(n). 见代码: #include<iostre ...

  2. java 图片上传

    代码是最有力量的,嘎嘎 @CrossOrigin@ApiOperation(value = "上传图片", notes = "上传图片", httpMethod ...

  3. Git如何将本地test分支设置跟踪origin/test分支

    前提条件: 有一个远程仓库其中只有一个master分支,然后我把它clone到本地 1.新建一个本地分支test, 2.然后把它push到远程仓库(git push origin test) 3.本地 ...

  4. POJ 1852:Ants

    Ants Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 11754   Accepted: 5167 Description ...

  5. 图片字节流生成bmp文件

    1 BITMAPFILEHEADER bfh;//文件头 2 bfh.bfType=0x4d42; bfh.bfOffBits=sizeof(bfh)+sizeof(BITMAPINFOHEADER) ...

  6. layui-注册界面

    注册页面register.html源代码: <!DOCTYPE html> <html lang="en"> <head> <meta c ...

  7. 找不到xml、找不到类

    解决java.lang.ClassNotFoundException  解决 java.io.FileNotFoundException: class path resource [xxx.xml] ...

  8. eclipse中使用jstl

    错误提示为"can not find the tag library for http://java.sun.com/jsp/jstl/core" 这是我在练习把axis2和普通j ...

  9. SpringBoot#JSR303

    __震惊了!,一遍一遍在业务逻辑中编写的验证条件被抽离了! 是什么: - Java Specification Requests 303 ,用于对javaBean 属性的验证. - 解决了什么问题: ...

  10. 025-PHP常用字符串函数(二)

    <?php $text = "My dog's name is Angus."; //print Angus print(substr($text, , )."&l ...