js中怎么将字符串中特定汉字替换
1个回答
2015-02-01
展开全部
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Ball</title>
<style type="text/css">
</style>
<script type="text/javascript" src="jquery-1.8.0.min.js"></script>
<script type="text/javascript">
$ (function ()
{
var text = $ ("div").text ();
text = text.replace (/(.*)你.*/, '$1');
alert (text);
})
</script>
</head>
<body>
<div>abcdefg我dfdf你sdfsdf</div>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询