Click here to Skip to main content
15,896,154 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hai Everyone
jQuery not work in Google Chrome,but it work in ie8,fire fox.
My actual process is i want change the height and width of the table .My JQuery code is

JavaScript
function InitLoad() {

    var w = $(window).width();
    var windowHight = $(window).height() - 123;
     
    if (PageTitle == "Default.aspx") {


        $(".centertbl").css({ "height": windowHight + "px" });
        $(".centertbl").css({ "width": w + "px" });
        $(".fowi").css({ "width": w + "px" });
        
    }
}
and
i call .centertbl as class in html table
HTML
<table class="centertbl"  width="100%"  
style="background-color: #C0C0C0; overflow: hidden; margin :0px">
                    <tr>
                     <td style="padding-removed 1%; height: 5px" colspan="2"></td>
                     </tr></table>


the above code worked for change the height and width based on browser inner height and width for table,if i run in ie8 and mozila it will work.i.e it will dynamically change height and width,but i chrome it not work pls reply how to solve this problem and also support all browser.

Pls reply asap

Regards
Aravind
Posted
Comments
ZurdoDev 13-Jul-13 22:07pm    
You'll have to use chromes developer tools to figure out why.
Sergey Alexandrovich Kryukov 14-Jul-13 1:16am    
Why are you using style class and element-embedded style (via the attribute "style")? Even though it's technically possible, it looks like a pretty big abuse. No wonder you can easily mess up things the way some layout engines are confused.
—SA

1 solution

Please see my comment to the question. Try to use only the style referenced through the HTML element class. I cannot guarantee that it immediately resolves your problem, but this is the way to sort things out properly. You should opt for consistent style programming in all cases, even if you did not have your present problem. So, please try.

—SA
 
Share this answer
 
v2
Comments
Aravindba 14-Jul-13 9:21am    
can u write bit of code here ?
centertbl is available in master page using javascript i change widht and height dynamically,in page init it change all child page.
-BA
Sergey Alexandrovich Kryukov 14-Jul-13 23:19pm    
What can I possibly write here?
I advised you to remove slyle="..." and move the content (in quotation marks) to CSS.
From your question, I guessed you know CSS or... don't you?
—SA
Aravindba 14-Jul-13 23:26pm    
why u say remove style ? i am not ask about style="...." ,i am asking about class(class="centertbl" ) and i find solution for support for all brower.
my old code is $(".centertbl").css({ "width": w + "px" }); and i change to $(".centertbl").css("width", w + "px");.
did u find and different ? just i remove whole barcket.Before u reply first u read question clearly and reply.my question is jquery not work in chrome only and specified place(class="centertbl") for change height and width and i not ask about background color,overflow or margin.
Sergey Alexandrovich Kryukov 15-Jul-13 8:25am    
Because having a mess is a source of problems, including incompatibilities. And did you spot the difference between "remove" and "move"?
Have all styles in CSS, just try.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900