当前位置: 代码迷 >> Web开发 >> 高手如何出去商品的名字详细内容如上
  详细解决方案

高手如何出去商品的名字详细内容如上

热度:134   发布时间:2012-08-13 13:21:53.0
高手求助怎么出去商品的名字详细内容如下
怎么将<strong></srrong>中间的内容去掉

Nike Air Max:: Nike Air Max 09+90<strong>::Blue Nike Air Max 09+90 Mens 0001</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike White Air Max 09+90 Mens 0002</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Blue Nike Air Max 09+90 Mens 0003</strong>
Nike Air Max:: Nike Air Max 09+90
Nike Air Max
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Green Air Max 09+90 Mens 0006</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Grey Air Max 09+90 Mens 0007</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Orange Air Max 09+90 Mens 0008</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike White Air Max 09+90 Mens 0009</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Black Air Max 09+90 Mens 0010</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::Nike Yellow Air Max 24-7 Mens 0001</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::Nike Red Air Max 24-7 Mens 0002</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::White Nike Air Max 24-7 Mens 0003</strong>

------解决方案--------------------
HTML code

<!DOCTYPE HTML>
<html lang="">
<head>
    <meta charset="gbk">
    <title></title>
</head>
<body>
    <div id="a">
    Nike Air Max:: Nike Air Max 09+90<strong>::Blue Nike Air Max 09+90 Mens 0001</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike White Air Max 09+90 Mens 0002</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Blue Nike Air Max 09+90 Mens 0003</strong>
Nike Air Max:: Nike Air Max 09+90
Nike Air Max
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Green Air Max 09+90 Mens 0006</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Grey Air Max 09+90 Mens 0007</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Orange Air Max 09+90 Mens 0008</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike White Air Max 09+90 Mens 0009</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Black Air Max 09+90 Mens 0010</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::Nike Yellow Air Max 24-7 Mens 0001</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::Nike Red Air Max 24-7 Mens 0002</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::White Nike Air Max 24-7 Mens 0003</strong>
    </div>
        <script>
            var $ = function(id){
                return document.getElementById(id);
            };
            var str = $('a').innerHTML;
            var re = /<(strong).+?\/\1>/gi;
            str = str.replace(re, '');
            alert(str)
        </script>
</body>
</html>

------解决方案--------------------
HTML code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<div id="demo">
Nike Air Max:: Nike Air Max 09+90<strong>::Blue Nike Air Max 09+90 Mens 0001</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike White Air Max 09+90 Mens 0002</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Blue Nike Air Max 09+90 Mens 0003</strong>
Nike Air Max:: Nike Air Max 09+90
Nike Air Max
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Green Air Max 09+90 Mens 0006</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Grey Air Max 09+90 Mens 0007</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Orange Air Max 09+90 Mens 0008</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike White Air Max 09+90 Mens 0009</strong>
Nike Air Max:: Nike Air Max 09+90<strong>::Nike Black Air Max 09+90 Mens 0010</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::Nike Yellow Air Max 24-7 Mens 0001</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::Nike Red Air Max 24-7 Mens 0002</strong>
Nike Air Max:: Nike Air Max 24-7:: Air Max 24-7 Mens<strong>::White Nike Air Max 24-7 Mens 0003</strong>
</div>
<script type="text/javascript">
var html = document.getElementById('demo').innerHTML;
html = html.replace(/(<strong>[^<]+<\/strong>)/img, '');
alert(html);
</script>
</body>
</html> 
  相关解决方案