21,886
社区成员
发帖
与我相关
我的任务
分享
<div class=c1>
<div class=c2>
<div class=c3>
bbbbbb
</div>
aaaa
</div>
ccccc
</div>
<div></div>
<div></div>
function getstr($string,$start,$end){
????
$str=?????;
return $str;
}
echo getstr($html,"<div class=c1>","</div>")
JS直接实现的用下边代码
<body onload="opt()">
<div id=a1>这里显示id=2的内容</div>
<div id=a2>div2显示内容</div>
</body>
<script type="text/javascript">
function opt(){
document.getElementById("a2").innerHTML=document.getElementById("a1").innerHTML;
}
</script>
jQuery实现代码如下:
<body>
<div id=a1>这里显示id=2的内容</div>
<div id=a2>div2显示内容</div>
</body>
<script type="text/javascript">
$(function(){
$("#a2").html($("#a1").html());
})
</script>