浏览页面看正常:<a href='http://www.k5227.com/diode/1025.htm'>本文来自【飞奔汽车】</a>源码出现的乱码:<a href='http://www.k5227.com/diode/1025.htm'>本文来自【飞奔汽车】</a>为什么 <a </a> 变成了< </a>这是整个JS应用代码://复制内容自动添加版权信息
var thehits=document.getElementById("thehit");
if (thehits!=null){
thehits.innerHTML="22936";
}document.body.oncopy = function ()
{
setTimeout(
function ()
{
var text = clipboardData.getData("text");
if (text)
{text = text + "\r\n<a href='"+location.href+"'>本文来自【飞奔汽车】</a>";
clipboardData.setData("text", text);
}
},
100
)
}
window.onload = function()
{
this.focus();
}
var thehits=document.getElementById("thehit");
if (thehits!=null){
thehits.innerHTML="22936";
}document.body.oncopy = function ()
{
setTimeout(
function ()
{
var text = clipboardData.getData("text");
if (text)
{text = text + "\r\n<a href='"+location.href+"'>本文来自【飞奔汽车】</a>";
clipboardData.setData("text", text);
}
},
100
)
}
window.onload = function()
{
this.focus();
}
浏览页面看正常:<a href='http://www.k5227.com/diode/1025.htm'>本文来自【飞奔汽车】</a>源码出现的乱码:<a href='http://www.k5227.com/diode/1025.htm'>本文来自【飞奔汽车】</a>为什么 <a </a> 变成了< </a>这个就是源码,没问题啊,不是乱码
这个是ascii码替换
在JS 里面转义下不就OK 了