相关疑难解决方法(0)

锚链接内的按钮在Firefox中有效但在Internet Explorer中无效吗?

除了我的链接外,我网站上的其他所有内容似乎都与所有浏览器兼容.它们出现在页面上,但它们不起作用.我的链接代码如下 -

<td bgcolor="#ffffff" height="370" valign="top" width="165">
    <p>
        <a href="sc3.html">
            <button style="width:120;height:25">Super Chem #3</button>
        </a> 
        <a href="91hollywood.html">
            <button style="width:120;height:25">91 Hollywood</button>
        </a> 
        <a href="sbubba.html">
            <button style="width:120;height:25">Super Bubba</button>
        </a> 
        <a href="afgoohash.html">
            <button style="width:120;height:25">Afgoo Hash</button>
        </a> 
        <a href="superjack.html">
            <button style="width:120;height:25">Super Jack</button>
        </a> 
        <a href="sog.html">
            <button style="width:120;height:25">Sugar OG</button>
        </a> 
        <a href="91pk91.html">
            <button style="width:120;height:25">91 x PK</button>
        </a> 
        <a href="jedi1.html">
            <button style="width:120;height:25">Jedi</button>
        </a>
    </p>
    <p>&nbsp;</p>
    <a href="http://indynile99.blogspot.com">
        <button style="width:120;height:25">Blog</button>
    </a>
    <p>&nbsp;</p>
</td>
Run Code Online (Sandbox Code Playgroud)

html firefox internet-explorer cross-browser button

72
推荐指数
8
解决办法
10万
查看次数

为什么内联JavaScript很糟糕?

始终建议通过将所有代码放在一个JS文件中来避免内联Javascript代码,该文件包含在所有页面中.我想知道,如果这不会导致重页面的性能问题.

例如,假设我们有数十个这样的函数

function function1(element){
var el=document.getElementsByClassName(element);
var size=el.length;
if(size==0) return;
for(i=0;i<size;i++){
// the process
}
}
Run Code Online (Sandbox Code Playgroud)

在每个页面上,我们需要运行函数来知道HTML中是否有相应的元素.

window.onload = function(){
function1('a');
....
function26('z');
};
Run Code Online (Sandbox Code Playgroud)

但如果将所有函数保存在外部JS文件中,并通过内联调用函数JavaScript,我们只能调用当前页面中所需的函数:

<script type="text/javascript">
window.onload = function(){
function6('f');
};
</script>
Run Code Online (Sandbox Code Playgroud)

从性能的角度来看,通过内联调用函数Javascript(当然不是最佳实践)来避免调用页面中不需要的大量函数不是有益的吗?

当然,这不仅仅限于功能,因为我们有很多addEventListener针对整个网站的s,它们在每个页面上被触发,不需要它们.

javascript performance unobtrusive-javascript dom-events

16
推荐指数
3
解决办法
1万
查看次数

如何使href在IE8中的按钮上工作

我想在IE8中href工作type="button".

<a href="submit.php"><input type="button" value="Submit" class="button" /></a>
Run Code Online (Sandbox Code Playgroud)

其他浏览器工作正常,但在IE8上面的代码不起作用.怎么解决?

更新

<form action="submit.php" method="post"">
<input type="submit" value="Submit" class="button" />
</form>
Run Code Online (Sandbox Code Playgroud)

我知道这种方式可以做到.但我想知道如何让它在IE8上运行而不需要的其他方法<form></form>

html xhtml internet-explorer-8

5
推荐指数
1
解决办法
5922
查看次数