0

I am working on a web site for an optical company. The company works with people that have minor visual impairment up through major impairment, some requiring special equipment in order to view web pages.

Because of the diverse client requirements, we are planning to make available, an option which allows the client, at the time of viewing, to select (stored in a cookie, option hooked to an ASP.NET checkbox) that will make the text size on the page larger and remove some of the pictures that are not required.

The text size is set in the DIV tag, Style "font-size: ##". What I want to do is when the checkbox is unchecked the page will use a normal size and when it's checked the ASP.NET page will change to a larger font. I am not sure how to change a DIV tag (client-side) with a server-side call.

Any ideas on how to do this?

One person elsewhere recommended that I dynamically create the div tag server-side (Response.Write()) but I don't want to use that if there is another way. Just seems like it will be more overhead when whats needed.

Thanks,

4

2 回答 2

3

为什么你需要做那个服务器端?我会进行客户端调用,捕获检查更改并使用 javascript 和 jQuery 更改 div 元素中的字体大小。

您也可以使用 jQuery 使其变得非常简单。

<div><input type="checkbox" onclick="toggleFontSize(this)" /> Change Font Size</div>

<div id="myDiv" style="font-size: 10px;">
Testing my new font size
</div>
<script src="jquery-1.3.2.min.js" type="text/javascript"></script>     
<script type="text/javascript">
    function toggleFontSize(obj){ 
       if(obj.checked){
          $('myDiv').css('font-size', '20px'); // jQuery selector here
       }else{
          $('myDiv').css('font-size', '10px'); // jQuery selector here
       }
    }
</script>
于 2010-01-11T00:50:59.550 回答
2

您可以将 设置divrunat="server"分配一个 ID 并在服务器端与之交互。或者您可以通过 javascript 在客户端立即更改大小并等待帖子记录选项。

于 2010-01-11T00:44:16.457 回答