亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

?????? ??? ??

??? ?? ??

JavaScript ??? ??? ??? ???? ???? ? ?????. String ??? ???? ??? ??? ????.

<script language="JavaScript">
var str_object = new String( str );
var str1 = String( str );
var str2 = str;
</script>

?? ? ?? ?? ? ? ?? ??? String ???? ???? ??? ??? ???? ???? ??? ?????. ? ??? String ??? ???? ???? str? ?? ???? ???? ???? ????. ? ?? ??? ??? ??? ???? ???? JavaScript??? ??? ??? ??? ?????.

?? ???? ???? ???? ?????.

alert( typeof str_object ); // ?? object
alert( typeof str1 ); // ?? ???
alert( typeof str2 ); ?? ??

?? ???????????????????????????????????????????????????????????????????????????????? ????? ??? ?? ? ??? ??


?? ???? ?? ?? ??? ???? ?????. ???? ??:

<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>php中文網(wǎng)(php.cn)</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>

String? indexOf()? ???? ? ?? ??? ????. ????? ??? ??:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</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>

match() ??? ??? ?? ? ?????. ????? ?? ??? ??, ???? ? ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</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>

replace() ???? ???? ?? ??? ?? ??? ????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<button onclick="myFunction()">點我</button>
<p id="demo">請訪問 Microsoft!</p>
<script>
function myFunction() {
    var str = document.getElementById("demo").innerHTML; 
    var txt = str.replace("Microsoft","php.cn");
    document.getElementById("demo").innerHTML = txt;
}
</script>
</body>
</html>

??? ?/??? ???? toUpperCase() / toLowerCase() ??? ?????.

var txt="Hello World!"; // String

var txt1=txt.toUpperCase(); ????
var txt2=txt.toLowerCase(); // txt2 ???? ???? ?????.

???? Strong>split() ??? ???? ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</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[2];
}
</script>
</body>
</html>

?? ??

Javascript( ) ??????, ???, ?? ?? ?? ? ?? ??? ?????.

?? JavaScript ?? ??:

var txt="??? ?? ???? ? "???"???.";document.write(txt);

JavaScript??? ?????? ????? ???? ???? ???? ?????. ?? ?? ???? ??? ?? ???? ?????. We are the ??

?? ??? ????? ????? ???? ???? ????? ??? ? ????.

var txt="We are the ?? "Vikings " from the north.";
document.write(txt);

JavaScript? ??? ??? ???? ?????. We are the ?? "Vikings" from the north.

?? ??? ?? ?? ??, ?? ??? ???? ????. ????? ???? ?????? ? ????.

Output
' ?????

" ????

\ ??? ??

n ? ??

r ??? ??

t ?

b ????

f ??? ??

???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <script type="text/javascript"> var str = "ipnx.cn"; document.write( str.split(".") + "<br />" ); document.write( str.split("") + "<br />" ); document.write(str.split(".", 2)); </script> </head> <body> </body> </html>