Solved

Increase/Decrease Font Size

Posted on 2006-07-06
7
300 Views
Last Modified: 2013-12-03
Hello,

I am trying to create an "Adjust Font Size" feature that looks and functions exactly like the one on this page: http://sports.espn.go.com/ncf/news/story?id=2503365.

Here are the features that I would like to include:

1. It needs to be cross browser compatible
2. I would like it to be developed using ASP dynamic stylesheets
3. Ideally I would like to set this up so that the user can select one of four small images, with each one triggering a different font size.
4. Through the use of cookies and ASP I would like the font that the user selects to be remembered
 
If someone can setup an example like above, it would be greatly appreciated!

Regards!
0
Comment
Question by:Gsx_Eclipse
  • 4
  • 3
7 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 17057974
easiest way would be to use different style sheets, then drop a cookie say with the bigger style sheets name, then have you style sheet referenced by it.

<%
styleSheet = request.cookies("styleSheet")
if styleSheet = "" OR ISNULL(styleSheet) then
    styleSheet = "/default.css"
end if
%>
<link href="<%=styleSheet%>" rel="stylesheet" type="text/css" />


have your links popup a page to drop the cookie:<a href="/style.asp?style=1" target="_blank">Style 1</a>

and on style.asp

<%
style = request.querystring("style")
Select Case style
   Case "1"
       response.cookies("styleSheet") = "/default.css"
   Case "2"
       response.cookies("styleSheet") = "/bigger.css"
   'etc....
End Select
%>
<script language="JavaScript">
  window.opener.location.reload();
  window.close();
</script>

HTH
0
 

Author Comment

by:Gsx_Eclipse
ID: 17058736
HTH,

Thank you for your reply.  Is there anyway that you can possibly setup a working example of this for me so that I can see it in action.  I am new to ASP and this will help me greatly.

Thanks!
0
 
LVL 25

Expert Comment

by:kevp75
ID: 17058804
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 25

Expert Comment

by:kevp75
ID: 17058820
the code is 5 pages, here they are....

default.asp:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<%
styleSheet = request.cookies("styleSheet")
if styleSheet = "" OR ISNULL(styleSheet) then
    styleSheet = "/style.css"
end if
%>
<link href="<%=styleSheet%>" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><a href="/style.asp?style=1" target="_blank">size 1</a>, <a href="/style.asp?style=2" target="_blank">size 2</a>, <a href="/style.asp?style=3" target="_blank">size 3</a> </td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>Normal Text </td>
        <td>&nbsp;</td>
    </tr>
    <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
    </tr>
</table>
</body>
</html>

style.asp:
<%
style = request.querystring("style")
Select Case style
   Case "1"
       response.cookies("styleSheet") = "/style.css"
   Case "2"
       response.cookies("styleSheet") = "/bigger.css"
  Case "3"
       response.cookies("styleSheet") = "/biggest.css"
   'etc....
End Select
%>
<script language="JavaScript">
  window.opener.location.reload();
  window.close();
</script>

style.css:
body {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: small;
      line-height: 1.2em;
      margin: 0px;
}

bigger.css:
body {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: medium;
      line-height: 1.2em;
      margin: 0px;
}

biggest.css:
body {
      font-family: Verdana, Arial, Helvetica, sans-serif;
      font-size: large;
      line-height: 1.2em;
      margin: 0px;
}
0
 

Author Comment

by:Gsx_Eclipse
ID: 17070333
Hello,

This is getting close to what I am looking for.  Is there anyway that you can redesign slightly so that it does not have to temporarily load a new window which then refreshes the current one the user is on.  Instead when a user clicks on one of the four options can it load without resfreshing the page, or can it just refresh the current page?



Thanks!
0
 
LVL 25

Accepted Solution

by:
kevp75 earned 150 total points
ID: 17070342
it's easy enough to do.

take the target="_blank" out of the links, and do a response.redirect("yourpage.ext") on the style.asp page.

No matter what how you do it, you will have to have the page refreshed in order to load the new css stylesheet
0
 

Author Comment

by:Gsx_Eclipse
ID: 17072176
Thanks for all your help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Highlight a word from some text 16 48
Add server behaviors to Dreamweaver CC 2015 2 128
UTC (timezone) without using an API 16 39
Voice recognition ASP or ASP.NET or JavaScript 2 60
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now