几种获取html页面代码的方法,但是对嵌入的页面却用不了。
var test=document.getElementById('#id').innerText;
var test=$("#id").html();
var test=document.getElementById("#id").innerHTML;
var test= document.getElementById("#id").value;
var test=null;
function test() {
$(document).ready(function (){
test=$("#id").html(); //仅获取div内容
});
//alert(test);
//UE.getEditor('editor').setContent(test); //把获取的内容放入富文本的编辑框
}
参考内容:
https://learn.jquery.com/using-jquery-core/document-ready/
本文介绍了几种在网页中获取HTML页面代码的有效方法,包括使用JavaScript的getElementById和jQuery的选择器来提取特定元素的内联HTML代码。然而,这些方法可能不适用于所有场景,特别是对于嵌入式页面内容。
1565

被折叠的 条评论
为什么被折叠?



