【发布时间】:2017-12-20 11:44:13
【问题描述】:
在我添加 document.getElementById("frame").src="https://www.youtube.com/embed/"+frm; 行之前它一直有效
但是现在即使我删除了这部分,所以让代码像以前一样并且工作正常,它仍然不起作用。我不知道为什么会这样。这可能是我现在缺少的一个小细节。有什么想法可以找到它是什么?
另外,我尝试从 XML 文件加载 <p></p> 文本,但也找不到解决方法。如果有人可以帮助我找到合适的方法,那就太好了
function bgClicked2 (idJ,pg,frm)
{
var id = document.getElementById("bgMAIN");
id.src="Pics/bgCLICKED2.png";
var id2=document.getElementById("previews");
id2.style.visibility="visible";
document.getElementById("planet").src="Pics/"+idJ+".png";
document.getElementById("frame").src="https://www.youtube.com/embed/"+frm;
}
function bgClicked()
{
var id,prg,frame;
id=document.activeElement.id;
frame=document.activeElement.name;
bgClicked2(id,"j",frame);
alert("ughjnj");
loadXMLDoc();
}
p, li{
font-size:17px;
font-style:normal;
color:#066;
position:relative;
float:right;
word-wrap:break-word;
width:651px;
margin-left:35px;
}
.button{
position:absolute;
margin-left:453px;
margin-top:315px;
z-index:2;
border-radius:50%;
border:none;
size:50px;
width:83px;
height:89px;
opacity:0;
}
<center>
<div class="upper"><img src="Pics/logo.png" width="75%" height="75%"/></div>
<!--//<div><img src="Pics/2_.png" style="right:9px; top:12 position:relative;" /></div>-->
<div class="spaceBoard">
<input type="button" class="button" onclick="bgClicked() " id="sun" name="piuKlpJmjfg"/>
<input type="button" class="world" onclick="j()" id="earth" name="pm7tfLvHmXA">
<img src="Pics/bgMAIN2.png" id="bgMAIN">
<span id="previews" class="previews">
<img src="Pics/sun.png" width="255" height="255" id="planet"/>
<img src="Pics/back.png" width="39" height="39" style="float:right; margin-left:11" id="btnOut"/>
<table style="float:right">
<tr>
<th><p id="paragraph">The sun is a star, a hot ball of glowing gases at the heart of our solar system. Its influence extends far beyond the orbits of distant Neptune and Pluto. Without the sun's intense energy and heat, there would be no life on Earth. And though it is special to us, there are billions of stars like our sun scattered across the Milky Way galaxy. If the sun were as tall as a typical front door, the Earth would be the size of a U.S. nickel. The temperature at the sun's core is about 27 million degrees Fahrenheit. Average diameter: 864,000 miles, about 109 times the size of the Earth.Rotation period at equator: About 27 days. Rotation period at poles: About 36 days. Surface temperature: 10,000 degrees Fahrenheit.Composition: Hydrogen, helium.</p></th>
</tr>
<tr>
<th><iframe id="frame" width="651" height="405" src="https://www.youtube.com/embed/piuKlpJmjfg" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen></iframe></th>
</tr>
</table>
</span>
</div>
【问题讨论】:
-
您是否在控制台中看到任何错误
-
没有。这就是为什么我很困惑
-
我找不到任何名为 j() 的函数。还有 bgclicked2() 中的参数是什么;
-
您是否尝试过按 ctrl+f5 强制刷新,浏览器可能缓存了您损坏的版本
-
是的,发布的代码对我有用(loadXMLDoc() 被注释掉了)。你是按右键吗? ;)
标签: javascript html css button frame