<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<style>
</style>
<script>
// 定义一个字符串
var str='aaa.doc.html.css';
/*var n=str.lastIndexOf('.'); //位置
alert(str.substring(n+1));*/
var arr=str.split('.');
alert(arr[arr.length-1]);
</script>
</head>
<body>
</body>
</html>
网友评论