我有这个问题,下面这个代码适用于除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)
问题详情:
测试:
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" type="text/css" />
<link href="http://source/ArticleLinks.css" rel="stylesheet" type="text/css" />
<meta content="source Publishing Corporation" name="Author" />
<meta content="Abstract and Applied Analysis is a mathematical journal devoted exclusively to the publication of high-quality research papers in the fields of abstract and applied analysis. Emphasis is placed on important developments in classical analysis, linear and nonlinear functional analysis, ordinary and partial differential equations, optimization theory, and control theory. Abstract and Applied Analysis supports the publication of original material involving the complete solution of significant problems in the above disciplines. Abstract and Applied Analysis also encourages the publication of timely and thorough survey articles on current trends in the theory and applications of analysis." name="Description" />
<link href="/journals/aaa/rss.xml" rel="alternate" title="Abstract and Applied Analysis latest articles" type="application/rss+xml" />
</head>
<body>
<form id="aspnetForm" action="../../../GetSpecialIssueArticles.aspx?journal=aaa&pubYear=2006&n=1" method="post" name="aspnetForm">
<div>
<input id="__VIEWSTATE" name="__VIEWSTATE" type="hidden" value="/wEPDwULLTE0MDYzMzg1NjJkZFPSsoFb4eXsUpu+K/Hi3MXvMKWO" />
</div>
<div id="container">
<div id="site_head">
<div class="logo">
<a href="/">
<img alt="source Logo" src="/images/source_Logo.jpg" style="border-width: 0px;" /></a>
</div>
<div id="ctl00_SearchPanel" onkeypress="javascript:return WebForm_FireDefaultButton(event, 'ctl00_Button1')">
<div class="search_container">
<div class="search">
<input id="ctl00_TxtSearchArticles" class="search_field" maxlength="2147483647" name="ctl00$TxtSearchArticles" type="text" />
<input id="ctl00_Button1" class="search_button" name="ctl00$Button1" type="submit" value="Go" />
</div>
<div class="search_advanced">
<a href="/search.aspx">Advanced Search</a></div>
</div>
</div>
<div class="slogan">
source Publishing Corporation</div>
</div>
<div class="source_links">
<ul>
<li><a href="/">Home</a></li>
<li><a href="/books/">Books</a> </li>
<li><a href="/journals/">Journals</a> </li>
<li><a href="/about.html">About Us</a></li>
</ul>
</div>
<div id="banner">
<img id="ctl00_ImgTitle" alt="Abstract and Applied Analysis" src="../../../images/banners/AAA.banner.jpg" style="border-width: 0px;" /></div>
<div id="journal_navigation">
<a id="ctl00_AboutNav" class="journal_nav_links" href="../">About this
Journal</a>
<a id="ctl00_MtsNav" class="journal_nav_links" href="http://mts.source">
Submit a Manuscript</a>
<a id="ctl00_TableofContentsNav" class="last_link" href="/journals/aaa/contents.html">
Table of Contents</a> </div>
<div id="content">
<!--left column-->
<div id="left_column">
<div class="green_strip">
<div class="journal_icon">
Journal Menu</div>
</div>
<div class="left_column_list">
<ul id="ctl00_BltJournalInformation">
<li><a href="/journals/aaa/ai.html">Abstracting and Indexing</a></li>
<li><a href="/journals/aaa/aims.html">Aims and Scope</a></li>
<li><a href="/journals/aaa/apc.html">Article Processing
Charges</a></li>
<li><a href="/journals/aaa/aip.html">Articles in Press</a></li>
<li><a href="/journals/aaa/guidelines.html">Author Guidelines</a></li>
<li><a href="/journals/aaa/biblio.html">Bibliographic Information</a></li>
<li><a href="/journals/aaa/contact.html">Contact Information</a></li>
<li><a href="/journals/aaa/editors.html">Editorial Board</a></li>
<li><a href="/journals/aaa/workflow.html">Editorial Workflow</a></li>
<li><a href="/journals/aaa/etoc.html">Free eTOC Alerts</a></li>
<li><a href="/journals/aaa/reviewers.html">Reviewers Acknowledgment</a></li>
<li><a href="/subs.html">Subscription Information</a></li>
</ul>
</div>
<div id="ctl00_SpecialIssuesDiv" class="special_issues">
<ul id="ctl00_BltSpecialIssues">
<li><a href="/journals/aaa/osi.html">Open Special Issues</a></li>
<li><a href="/journals/aaa/psi.html">Published Special Issues</a></li>
<li><a href="/journals/aaa/siguidelines.html">Special Issue
Guidelines</a></li>
</ul>
</div>
<div class="ad2">
<a href="/special.issues.html">Call for Proposals for <br />
Special Issues</a></div>
<!--end left column-->
<!--middle content--></div>
<div class="middle_content">
<div id="ctl00_ContentPlaceHolder1_CoverDiv" class="right_column">
<div class="cover" visible="false">
<img id="ctl00_ContentPlaceHolder1_imgDownLoadIssue" class="img_cover" src="/images/si/9775945445.jpg" style="border-width: 0px;" />
</div>
<div id="ctl00_ContentPlaceHolder1_lnkDownloadIssueDiv" class="download_pdf">
<a id="ctl00_ContentPlaceHolder1_lnkDownloadIssue" class="download_box" href="/journals/AAA/si/9775945445.pdf">
PDF Download (1.7MB)</a> </div>
</div>
<h2>Topological and variational methods of nonlinear analysis and
their applications</h2>
<span class="press_info">Guest Editors: V. G. Zvyagin, Yu. E. Gliklikh,
V. V. Obukhovskii, A. I. Perov, B. N. Sadovskii, Yu. I. Sapronov,
V. A. Sobolev, and Z. B. Tsaliuk</span>
<ul class="more_articles_ul">
<li><a href="/journals/aaa/2006/093926.abs.html">Topological
and variational methods of nonlinear analysis and their applications</a>,
V. G. Zvyagin, Yu. E. Gliklikh, and V. V. Obukhovskii<br />
Volume 2006 (2006), Article ID 93926, 2 pages</li>
<li><a href="/journals/aaa/2006/036215.abs.html">The Kolmogorov
equation in the stochastic fragmentation theory and branching
processes with infinite collection of particle types</a>, R.
Ye. Brodskii and Yu. P. Virchenko<br />
Volume 2006 (2006), Article ID 36215, 10 pages</li>
<li><a href="/journals/aaa/2006/039786.abs.html">Necessary and
sufficient conditions for global-in-time existence of solutions
of ordinary, stochastic, and parabolic differential equations</a>,
Yuri E. Gliklikh<br />
Volume 2006 (2006), Article ID 39786, 17 pages</li>
<li><a href="/journals/aaa/2006/086173.abs.html">On calculation
of the relative index of a fixed point in the nondegenerate
case</a>, A. V. Guminskaya and P. P. Zabreiko<br />
Volume 2006 (2006), Article ID 86173, 11 pages</li>
<li><a href="/journals/aaa/2006/082602.abs.html">Theorem on
the union of two topologically flat cells of codimension 1 in <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mrow><mml:msup><mml:mi>
?</mml:mi><mml:mi>n</mml:mi></mml:msup></mml:mrow></mml:math></a>,
A. V. Chernavsky<br />
Volume 2006 (2006), Article ID 82602, 9 pages</li>
<li><a href="/journals/aaa/2006/078928.abs.html">Bourgin-Yang-type
theorem for <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>
a</mml:mi></mml:math>-compact perturbations of closed operators.
Part I. The case of index theories with dimension property</a>,
Sergey A. Antonyan, Zalman I. Balanov, and Boris D. Gel'man<br />
Volume 2006 (2006), Article ID 78928, 13 pages</li>
<li><a href="/journals/aaa/2006/048132.abs.html">Gantmacher-Kre?n
theorem for 2 nonnegative operators in spaces of functions</a>,
O. Y. Kushel and P. P. Zabreiko<br />
Volume 2006 (2006), Article ID 48132, 15 pages</li>
<li><a href="/journals/aaa/2006/051794.abs.html">An oriented
coincidence index for nonlinear Fredholm inclusions with nonconvex-valued
perturbations</a>, Valeri Obukhovskii, Pietro Zecca, and Victor
Zvyagin<br />
Volume 2006 (2006), Article ID 51794, 21 pages</li>
<li><a href="/journals/aaa/2006/043560.abs.html">Flow of electrorheological
fluid under conditions of slip on the boundary</a>, R. H. W.
Hoppe, M. Y. Kuzmin, W. G. Litvinov, and V. G. Zvyagin<br />
Volume 2006 (2006), Article ID 43560, 14 pages</li>
<li><a href="/journals/aaa/2006/056367.abs.html">The integral
limit theorem in the first passage problem for sums of independent
nonnegative lattice variables</a>, Yuri P. Virchenko and M.
I. Yastrubenko<br />
Volume 2006 (2006), Article ID 56367, 12 pages</li>
<li><a href="/journals/aaa/2006/094509.abs.html">On a certain
functional equation in the algebra of polynomials with complex
coefficients</a>, E. Muhamadiev<br />
Volume 2006 (2006), Article ID 94509, 15 pages</li>
<li><a href="/journals/aaa/2006/090837.abs.html">The mappings
of degree 1</a>, Maria N. Krein<br />
Volume 2006 (2006), Article ID 90837, 14 pages</li>
<li><a href="/journals/aaa/2006/098081.abs.html">Surgery and
the relative index in elliptic theory</a>, V. E. Nazaikinskii
and B. Yu. Sternin<br />
Volume 2006 (2006), Article ID 98081, 16 pages</li>
</ul>
</div>
<!--End middle content-->
<div class="lock">
</div>
</div>
</div>
<div id="footer">
Copyright © 2009 source Publishing Corporation. All rights reserved.</div>
<div>
<input id="__EVENTTARGET" name="__EVENTTARGET" type="hidden" value="" />
<input id="__EVENTARGUMENT" name="__EVENTARGUMENT" type="hidden" value="" />
<input id="__EVENTVALIDATION" name="__EVENTVALIDATION" type="hidden" value="/wEWAwLtoumZCALf45uzBALl97ftDc6OBH/ckFnY/ReuOp8cM4AI4UJ7" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script src="/WebResource.axd?d=MWyuQ-y_HwfuoPD0hR0Hzw2&t=633562784243119689" type="text/javascript"></script>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是jquery链接
<script src="http://beta.source/Scripts/JQInt.js" type="text/javascript"></script>
Run Code Online (Sandbox Code Playgroud)
jQuery是跨浏览器兼容的.问题更可能出现在你的代码中而不是jQuery源代码中,所以这将是第一个看起来的地方.
第一件事就是使用浏览器检测代码.jQuery建议使用$.support而不是尝试为特定的浏览器版本定制代码,因为您的代码将更加灵活.
其次,您期望看到的行为是什么,您在IE et.al中看到了什么以及您在Firefox中看到了什么?更清楚地了解您的期望可能会更快地找到正确的答案.
编辑:
这是一个使用您的代码的工作演示,适用于Firefox 3.5.3.添加/编辑 URL以查看代码.可以看出,所有<div>元素都设置为width 100px.当DOM完成加载,的宽度<div class="download_box">和<div class="download_pdf">通过缩短22px在比IE之外的所有浏览器.
jQuery代码
$(document).ready(function () {
var marker = $('#browser');
$.each($.browser, function(i, val) {
$("<div>" + i + " : <span>" + val + "</span>")
.appendTo(marker);
});
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)
相关的HTML
<div class="img_cover" style="width:100px;background-color:blue;">.img_cover</div>
<div class="download_box" style="width:100px;background-color:blue;">.download_box</div>
<div class="download_pdf" style="width:100px;background-color:blue;">.download_pdf</div>
<div class="right_column" style="width:100px;background-color:blue;">.right_column</div>
<br/>
<div id="browser"></div>
Run Code Online (Sandbox Code Playgroud)