把它替换成:<BODY bgcolor="#FFFFFF" text="#000000">

解决方案 »

  1.   

    <script>
    var str = '<BODY bgcolor="#FFFFFF" text="#000000" onmouseup="if(document.all) document.selection.empty()" oncontextmenu="return false" onmousemove="if(document.all) document.selection.empty()" oncopy="if(document.all) document.selection.empty()" onselect="if(document.all) document.selection.empty()">';var nstr = str.replace(/^<body.+(bgcolor=\".+?\").*(text=\".+?\").*>$/i,'<body $1 $2>');
    alert(nstr);
    </script>