把注释后面的单引号替换成 ´ 双引号替换成 "
求个高效的方法,因为文件很大。
\n<br/>//aaa we're aaa aaa "xxx"\n<br/>
function yyy() {
var s = '不替换';
}
//aaa we're aaa aaa aaa\n<br/>
//xxx we're xxx xxx "xxx"\n<br/>script type="text/javascript">
function goit() {
var code = document.getElementById("m").value;
//不会写了
alert(code);
document.getElementById('result').innerHTML = code;
}
</script>
<body>
<form method="post" name="form1">
<div align="center">
<textarea rows="18" name="S1" style="width:100%" id="m">
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if were sett'ing style values
/** Look for the case where we're accessing a style value **/
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
/** Look for the case where we're accessing a style value **/
// Check to see if we're setting style values
</textarea>
</div>
<input type="button" value="HTML" onclick="return goit()" />
<input type="reset" value="清空内容" />
</form>
<div id="result"></div>
</body>
求个高效的方法,因为文件很大。
\n<br/>//aaa we're aaa aaa "xxx"\n<br/>
function yyy() {
var s = '不替换';
}
//aaa we're aaa aaa aaa\n<br/>
//xxx we're xxx xxx "xxx"\n<br/>script type="text/javascript">
function goit() {
var code = document.getElementById("m").value;
//不会写了
alert(code);
document.getElementById('result').innerHTML = code;
}
</script>
<body>
<form method="post" name="form1">
<div align="center">
<textarea rows="18" name="S1" style="width:100%" id="m">
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if were sett'ing style values
/** Look for the case where we're accessing a style value **/
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
/** Look for the case where we're accessing a style value **/
// Check to see if we're setting style values
</textarea>
</div>
<input type="button" value="HTML" onclick="return goit()" />
<input type="reset" value="清空内容" />
</form>
<div id="result"></div>
</body>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<META http-equiv="Content-Style-Type" content="text/css">
</head>
<script language=javascript>
function goit(){
var s=document.getElementById("m").innerHTML;
var a=s.replace(/'/g,"´ ");
var a=s.replace(/"/g,"" ");
document.getElementById('result').innerHTML = a;
}
window.onload=function(){
} </script>
<body>
<form method="post" name="form1">
<div align="center">
<textarea rows="18" name="S1" style="width:100%" id="m">
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if were sett'ing style values
/** Look for the case where we're accessing a style value **/
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
/** Look for the case where we're accessing a style value **/
// Check to see if we're setting style values
</textarea>
</div>
<input type="button" value="HTML" onclick="return goit()" />
<input type="reset" value="清空内容" />
</form>
<div id="result"></div>
</body>
</html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<META http-equiv="Content-Style-Type" content="text/css">
</head>
<script language=javascript>
function goit(){
var s=document.getElementById("m").innerHTML;
var a=s.replace(/'/g,"´ "); var c=a.replace(/"/g,"" "); document.getElementById('result').innerText = c;
}
window.onload=function(){
} </script>
<body>
<form method="post" name="form1">
<div align="center">
<textarea rows="18" name="S1" style="width:100%" id="m">
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if were sett'ing style values
/** Look for the case where we're accessing a style value **/
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
/** Look for the case where we're accessing a style value **/
// Check to see if we're setting style values
</textarea>
</div>
<input type="button" value="HTML" onclick="return goit()" />
<input type="reset" value="清空内容" />
</form>
<div id="result"></div>
</body>
</html>
var str = ' \n<br/>//aaa we\'re aaa aaa "xxx"\n<br/> //xxx we\'re xxx xxx "xxx"\n<br/>',r = {"'":"´",'"':'"'}alert(str.replace(/'|"/g,function($0){return r[$0];}))
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<META http-equiv="Content-Style-Type" content="text/css">
</head>
<script language=javascript>
function goit(){
var s=document.getElementById("m").innerHTML; var matchx=/\n/;
var match1=/\/\/.+'.+/g;
var match2=/\/\/.+".+/g; var a=s.split(matchx);
var ret=[];
var tmp;
for(var i=0;i<a.length;i++){
if(match1.test(a[i])||match2.test(a[i])){
tmp=a[i].replace(/'/g,"&acot ");
ret[i]=tmp.replace(/"/g,"" ")
}else{
ret[i]=a[i];
}
}
alert(ret) document.getElementById('result').innerText = ret.join(",");
}
window.onload=function(){
} </script>
<body>
<form method="post" name="form1">
<div align="center">
<textarea rows="18" name="S1" style="width:100%" id="m">
// Look for the case where we're accessing a style value
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
// Check to see if were sett'ing style values
/** Look for the case where we're accessing a style value **/
if ( name.constructor == String )
if ( value === undefined )
return this[0] && jQuery[ type || 'attr' ]( this[0], name );
else {
options = {};
options[ name ] = value;
}
/** Look for the case where we're accessing a style value **/
// Check to see if we're setting style values
</textarea>
</div>
<input type="button" value="HTML" onclick="return goit()" />
<input type="reset" value="清空内容" />
</form>
<div id="result"></div>
</body>
</html>
用'