【发布时间】:2016-02-17 15:59:17
【问题描述】:
我正在创建一个使用 jQuery、iFrames 并具有简单 CSS 的 HTML 页面。当我对来自 openweathermap.org 的 json 文件运行 jQuery 脚本时,它会覆盖设置的 HTML 背景颜色以及任何 iframe。有什么建议吗?
<style>
body {
background-color: #ff5000;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<div id = "weather"></div>
<script>
$( "weather" ).ready(function(){
$.getJSON("http://api.openweathermap.org/data/2.5/weather?q=Castlebar,ie&appid=44db6a862fba0b067b1930da0d769e98");
document.write('hello');
console.log('works')
});
</script>
【问题讨论】:
-
你的问题是什么?
-
请找出document.write - w3schools.com/jsref/met_doc_write.asp
标签: javascript jquery html json api