小编Mos*_*amy的帖子

使用firefox的jQuery问题,是不是跨浏览器兼容?

我有这个问题,下面这个代码适用于除Firefox以外的所有浏览器,它在外部js文件和aspx文件中的链接

$(document).ready(function () {
    var h = $(".img_cover").width() ;
    if ($.browser.msie) {
    $(".download_box").width(h + 1);
    $(".download_pdf").width(h + 1);
    $(".right_column").width(h);}
    else{
    $(".download_box").width(h - 22);
    $(".download_pdf").width(h - 22);  
    }
 });
Run Code Online (Sandbox Code Playgroud)

问题详情:

  • 有一个杂志的图像,下面有一个下载按钮
  • 那些杂志图像有不同的大小,所以调整下面的图像下方的下载按钮的宽度以匹配宽度是必要的我写了这个jquery代码自动执行此操作..

测试:

Local:适用于所有浏览器

Web服务器:(外部链接到ASPX主服务器)

  • Firefox:jquery代码未初始化

  • Explorer 6/7/8:工作正常

  • 歌剧:工作正常

生成的aspx中的代码

<!DOCTYPE html PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML">

<head id="ctl00_Header">
<title>Abstract and Applied Analysis — An Open Access Journal</title>
<link href="../../../styles/source_print.css" media="print" rel="stylesheet" type="text/css" />
<script src="http://beta.source/Scripts/lib/jquery.js" type="text/javascript"></script>




<script src="http://beta.source/Scripts/JQInt.js" type="text/javascript"></script>




<link href="http://beta.source/styles/source.css" rel="stylesheet" type="text/css" />
<link href="/styles/xml_display.css" rel="stylesheet" …
Run Code Online (Sandbox Code Playgroud)

firefox jquery

-1
推荐指数
1
解决办法
587
查看次数

标签 统计

firefox ×1

jquery ×1