It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                        
                    
                
            
                7年前关闭。
        

    

我想使用JavaScript在我的网站的第3方网站上显示特定div元素的内容。我知道我要显示的div元素的ID。能做到吗?

最佳答案

您无法使用Javascript执行此操作。

您必须使用服务器上的脚本(使用类似PHP的东西)下载页面,然后使用该下载的数据浏览其DOM,然后选择所需的元素。

Javascript仅在浏览器中显示的当前页面上起作用,它不能(不应)与其他网站对话。

关于javascript - 在我网站的另一个网页上显示div的内容,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13524568/

10-11 22:25
查看更多