猿问
JS <span>1<span> 替换为:<td>1</td> ?
JS 怎么把 <span>1<span> 替换为:<td>1</td>
谢谢!
斯蒂芬大帝
浏览 317
回答 2
2回答
RISEBY
<html><head><title></title></head><body><script type="text/javascript">window.onload=function (){var str="<span>1</span>";var str_1=str.replace(/(<span>)(1)<\/span>/g,"<td>$2</td>");alert(str_1);}</script></body>不知道这样是不是你所描述的那样呢????
0
0
0
哔哔one
var oldStr = "<span>1<span><span>1<span>";//var newStr = oldStr.replace("<span>1<span>","<td>1</td>"); //替换第一个var newStr = oldStr.replace(eval("/<span>1<span>/g"),"<td>1</td>"); //替换所有
0
0
0
随时随地看视频
慕课网APP
相关分类
Java
Html5
我要回答