js中replace的用法(两种常用举例,还有好多用法不一一列举)
2017-02-11 17:19
344 查看
1、替换特定字符 <html> <body> <script type="text/javascript"> var str="Visit Microsoft!" document.write(str.replace(/Microsoft/,"W3School")) </script> </body> </html> 2、全局替换 <html> <body> <script type="text/javascript"> var str="Welcome to Microsoft! "; str=str + "We are proud to announce that Microsoft has "; str=str + "one of the largest Web Developers sites in the world."; document.write(str.replace(/Microsoft/g, "W3School")); </script> </body> </html> js中replace的用法(两种常用举例,还有好多用法不一一列举) |
相关文章推荐
- js中replace的用法(两种常用举例,还有好多用法不一一列举)
- JS中replace()用法举例
- js replace常用用法
- js一些用法及几个常用的ASP代码
- prototype.js常用函数及其用法
- prototype.js常用函数及其用法
- prototype.js常用函数及其用法
- prototype.js常用函数及其用法
- js中replace的用法
- prototype.js常用函数及其用法
- prototype.js常用函数及其用法
- 常用的JS与XML结合用法 简单示例
- prototype.js常用函数及其用法
- js中replace的用法
- js中replace的用法
- prototype.js常用函数及其用法
- JavaScript封装的常用工具类库bee.js用法详解【经典类库】
- prototype.js常用函数及其用法
- 基础的prototype.js常用函数及其用法
- prototype.js常用函数及其用法