正则表达式,IE不正常,高手指点
<scripttype="text/javascript">onload=function(){varslStr=document.getElementById("wor...
<script type="text/javascript">
onload=function(){
var slStr=document.getElementById("word_list").innerHTML;
slStr=slStr.replace(/\<([a-z][a-z])\>/g,"<span class='$1'>");
slStr=slStr.replace(/(<\/[a-z][a-z]>)/g,"<\/span>");
slStr=slStr.replace(/(\<p onclick=\"Snd\(\')/g,"\<p onclick=\"Snd\(\'");
document.getElementById("word_list").innerHTML=slStr;
//alert(slStr);
}
</script>
<div class="content_wrd" id="word_list">
<p onclick="Aud('good');"><su>g<sr>oo</sr>d </su> <ph>/gJd/ </ph><mn><i>adj.</i>好的</mn></p>
</div>
IE不正常,高手指点
第六行为:
slStr=slStr.replace(/(\<p onclick=\"Aud\(\')/g,"\<p onclick=\"Snd\(\'"); 展开
onload=function(){
var slStr=document.getElementById("word_list").innerHTML;
slStr=slStr.replace(/\<([a-z][a-z])\>/g,"<span class='$1'>");
slStr=slStr.replace(/(<\/[a-z][a-z]>)/g,"<\/span>");
slStr=slStr.replace(/(\<p onclick=\"Snd\(\')/g,"\<p onclick=\"Snd\(\'");
document.getElementById("word_list").innerHTML=slStr;
//alert(slStr);
}
</script>
<div class="content_wrd" id="word_list">
<p onclick="Aud('good');"><su>g<sr>oo</sr>d </su> <ph>/gJd/ </ph><mn><i>adj.</i>好的</mn></p>
</div>
IE不正常,高手指点
第六行为:
slStr=slStr.replace(/(\<p onclick=\"Aud\(\')/g,"\<p onclick=\"Snd\(\'"); 展开
2个回答
展开全部
调试通过:
slStr = slStr.replace(/<([A-z]{2})>/g,function(m,n){n="<span class='" + n.toLowerCase() + "'>";return n;})
slStr = slStr.replace(/<\/([A-z]{2})>/g,function(m,n){n="</span>";return n; })
slStr=slStr.replace(/(\<p onclick=\"Aud\(\')/g,"\<p onclick=\"Snd\(\'");
slStr = slStr.replace(/<([A-z]{2})>/g,function(m,n){n="<span class='" + n.toLowerCase() + "'>";return n;})
slStr = slStr.replace(/<\/([A-z]{2})>/g,function(m,n){n="</span>";return n; })
slStr=slStr.replace(/(\<p onclick=\"Aud\(\')/g,"\<p onclick=\"Snd\(\'");
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询