public static void main(String[] args) throws Exception {
JSONParser parser = new JSONParser();
JSONObject jsonObject = (JSONObject) parser.parse(JSON);
JSONArray ja = (JSONArray) jsonObject.get("issues");
for(int i=0;i<ja.size() ; i++){
JSONObject tempJsonObj = (JSONObject) ja.get(i);
System.out.println(String.format("ID: %s", tempJsonObj.get("id").toString()));
JSONObject fields = (JSONObject) tempJsonObj.get("fields");
JSONObject issuetype = (JSONObject) fields.get("issuetype");
System.out.println(String.format("Name: %s", fields.get("name").toString()));
System.out.println(String.format("Data: %s", issuetype.get("data").toString()));
}
}
我正在检查网站上生成的上述代码,我看到了:
ID: 120171
Name: Story
Data: inprogress
ID: 1201
Name: plot
Data: Unknown
我希望它能使vertical-aline具有值<script src="https://apis.google.com/js/platform.js"></script>
<div class="g-ytsubscribe" data-channelid="UCt7Qb8JdtlG_pO1Pr4w2jrQ" data-layout="default" data-count="default"></div>
,而不是<div id="___ytsubscribe_0" style="text-indent: 0px; margin: 0px; padding: 0px; border-style: none; float: none; line-height: normal; font-size: 1px; vertical-align: baseline; display: inline-block; width: 104px; height: 24px; background: transparent;"><iframe frameborder="0" hspace="0" marginheight="0" marginwidth="0" scrolling="no" style="position: static; top: 0px; width: 104px; margin: 0px; border-style: none; left: 0px; visibility: visible; height: 24px;" tabindex="0" vspace="0" width="100%" id="I0_1459495947902" name="I0_1459495947902" src="https://www.youtube.com/subscribe_embed?usegapi=1&channelid=UCt7Qb8JdtlG_pO1Pr4w2jrQ&layout=default&count=default&origin=http%3A%2F%2Feverydayrelay.com&gsrc=3p&ic=1&jsh=m%3B%2F_%2Fscs%2Fapps-static%2F_%2Fjs%2Fk%3Doz.gapi.en.O7qc2VuIvpU.O%2Fm%3D__features__%2Fam%3DEQ%2Frt%3Dj%2Fd%3D1%2Frs%3DAGLTcCPZ7Tpph6RiCDsul5sXKhzE5OYMaQ#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Conload&id=I0_1459495947902&parent=http%3A%2F%2Feverydayrelay.com&pfname=&rpctoken=13548707" data-gapiattached="true"></iframe></div>
,如上所示
如何指定,因为它是生成的?
答案 0 :(得分:1)
很遗憾,您提供的代码会为您自己创建一个iframe
引用不同的域。
这意味着您无法修改随附的CSS。
您可以在此处详细了解同源政策 - https://developer.mozilla.org/en-US/docs/Web/Security/Same-origin_policy
如果iframe
来自您网页所在的同一个域,则可以通过JS更改CSS - More information here
旁注 - 如果您尝试更改它的定位,则可能值得尝试将小部件包装在您自己的div
中,并将CSS应用于div
。