<person id = "1">we are persons</person>js如何取出we are persons
<person id = "1">we are persons</person>js如何取出we are persons
------解决方案--------------------var a=document.getElementById("1").innerHTML;
------解决方案--------------------jQuery 版
var a = $("#1").html();
------解决方案--------------------var text=document.getElementById("1").innerHTML;
alert(text);
------解决方案--------------------<script type="text/javascript">
var str='<divid = "1">we are persons</div>js如何取出we are persons';
if(b=str.match(/<div[^>]*>([^<]*)<\/div>/)){
alert(b[1]);
}
</script>
------解决方案--------------------通过dom ,正则。
------解决方案--------------------字符串的话
var a = '<divid = "1">we are persons</div>';
var div = document.createElement("div");
div.innerHTML = a;
alert(div.firstChild.innerHTML);