您的位置:首页 > 编程语言 > PHP开发

JS中类似PHP中的strrpos\substr的函数--可用

2014-06-04 20:35 281 查看
<html>
<body>

<script type="text/javascript">

var str="Hello world!"
document.write(str.lastIndexOf("Hello") + "<br />")
document.write(str.lastIndexOf("World") + "<br />")
document.write(str.lastIndexOf("world"))

</script>

</body>
</html>


<html>
<body>

<script type="text/javascript">

var str="Hello world!"

document.write(str.substring(3))

</script>

</body>
</html>


lastIndexOf
substring
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: