Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我对这些东西有点陌生,但我希望能够输入文件路径或 url,然后 javascript 将读取某个 div 标签,然后从该 html 页面中获取它并将其放在另一个页面中,我可以还输入 url 或文件路径。这可能吗?任何人都可以让我走上正轨吗?
使用Jquery和AJAX,您可以指定文件路径并读取某个 div 标签的 HTML。我不确定您是否可以将该 html 放入与您所在的页面不同的页面中。
$.ajax({ url: 'ajax/test.html', success: function(data) { $('.result').html($(data).find("#myDiv").html()); } });