tags:

views:

285

answers:

2

Hello guys,

I have problem here with this code below it works on all browsers except Firefox ,it's in external js file and the link in aspx file

$(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);  
    }
 });

Issue details:

  • there is an image of a magazine and there is a download button below it
  • those magazine images come in different sizes, so adjusting the width of the download button below that image to match the width is necessary I wrote this jquery code to do this automatically..

Testing:

Local: works fine on all browsers

Web Server: (externally linked to ASPX master)

  • Firefox: jquery code not initialized

  • Explorer 6/7/8: works fine

  • Opera: works fine

Code in the generated aspx

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

<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&amp;pubYear=2006&amp;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"&gt;
      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"&gt;&lt;mml:mrow&gt;&lt;mml:msup&gt;&lt;mml:mi&gt;
        ℝ</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"&gt;&lt;mml:mi&gt;
        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&amp;t=633562784243119689" type="text/javascript"></script>
</form>

</body>

</html>

This is the jquery link

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

jQuery is cross-browser compatible. The problem is more likely to be in your code than in the jQuery source, so that would be the first place to look.

The first thing that stands out is the use of browser-detection code. jQuery recommends use of $.support instead of attempting to tailor code to specific browser versions, as your code will be more flexible going forward.

Secondly, what is the behaviour that you expect to see, what do you see in IE et.al and what do you see in Firefox? Having a clearer picture of your expectations is likely to lead more quickly to the correct answer.

EDIT:

Here's a Working Demo using your code, that works for me in Firefox 3.5.3. Add /edit to the URL to see the code. As can be seen, all <div> elements are set to be width 100px. When the DOM has finished loading, the width of <div class="download_box"> and <div class="download_pdf"> is shortened by 22px in all browsers other than IE.

jQuery code

$(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);  
    }
 });

relevant 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>
Russ Cam
thnx alot,i tried to make alert(h);but it didn't work on Firefox ,and worked on Opera,IE...i think the problem is firefox didnt see the code inside the $(document).ready(function () {
Mossad osamy
it will see the code inside $(document).ready() as demonstrated in the example. Can you amend your question post more information about how your page(s)/file(s) are setup. Something like the following- "I have this is in a Master Page - CODE HERE -", "I have this in a separate .js file - CODE HERE", etc, etc.
Russ Cam
At the moment, we can't see where the problem is exactly as in the context of the code that you have posted, everything works as expected.
Russ Cam
i know and it worked correctly on my local pc but when it attached on the aspx file and uploaded to the server Firefox didn't respond
Mossad osamy
+2  A: 

jQuery is cross-broswer compatible, as everyone is pointing out, so I'm not going to touch that part of the question. As for you question about the code not working in FF, can you try this:

// Note the px.
$(".download_box").width((h - 22) + "px");
$(".download_pdf").width((h - 22) + "px");

instead of

$(".download_box").width(h - 22);
$(".download_pdf").width(h - 22);
Kieron
You should use brackets when mixing strings and integers... `((h - 22) + "px")`
nickf
thnx 4 ur efforts but it didn't work :(
Mossad osamy
Good point @nickf, corrected.
Kieron