当我输入这段代码时,它不是同时运行其中一个,而是哪个先运行。外部文件中的javascript代码
var topBox = document.getElementById('boxOne');
topBox.textContent = 'hello!'
var bottomSection = document.getElementById('bottomSection');
bottomSection.onmouseover = function() {
bottomSection.textContent = '';
bottomSection.style.padding = '';
};
bottomSection.onmouseout = function() {
bottomSection.textContent = '';
bottomSection.style.padding = '';
};
您在输入呢?它与“外部文件”有什么关系? – UnholySheep
这两个函数都做同样的事情,你怎么知道哪一个运行,哪一个不是? – JJJ
我从头开始建立一个网站,并在崇高的编辑器中有HTML加JavaScript和CSS页面。如果我首先有'box0ne'代码,它只是改变这个元素。那么如果我将其更改为'bottomSection'代码,那么这个代码就可以工作,而另一个则不会,就好像它停止并且不会运行其他代码一样?很奇怪。 – Stuart