Click here to Skip to main content
15,886,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,
i have a master page and master page body id= "sitebody1" and on clicking a button i am increasing the font size by javascript function.
The font size of master page contents are increasing but content page font size is not increased.
following is sample code
Jacascript
JavaScript
function set_font_size(fontType) {
        if (fontType == "increase") {
            if (fontSize < 100) {
                fontSize = parseInt(fontSize) + 15;
            }
        } else {
            fontSize = 75;
        }
      document.getElementById("sitebody1").style.fontSize = fontSize + "%";

Design
HTML
<body id="sitebody1">
 onclick="set_font_size('increase')
of a button
Posted
Updated 7-Oct-15 0:36am
v2
Comments
Naveen.Sanagasetti 7-Oct-15 6:36am    
Make sure while posting a question please follow the rules and regulations.
[no name] 7-Oct-15 7:07am    
As per code, it should work in both the pages. Is any other CSS in child page which overriding the font-size property. Please cross check.
Member 8232678 8-Oct-15 0:24am    
Thanks sir,
As you told child page have a css style and after removing it, its works fine.
[no name] 8-Oct-15 0:42am    
:)
Member 8232678 8-Oct-15 5:08am    
can we override the content page css from master page?

1 solution

There is no sign of fontSize!
Also your indentation of code suggest that you think that the else part belongs to the if(fontType...) where it belongs to the if(fontSize...) part...

Check here a jquery aided solution (of some kind): http://jsfiddle.net/1qhk4w38/[^]
 
Share this answer
 

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