codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Change link color based on screen resolution  vanessa19 at 20:50 on Monday, February 28, 2005
 

Hey all..

I am trying to change a link's color, based on the user's screen resolution.

The javascript I have is:

<script type="text/javascript">

var RecommendedSize;

if(window.screen.width<690){
RecommendedSize = "640";
}else if(window.screen.width<850){
RecommendedSize = "800";
}else if(window.screen.width<1079){
RecommendedSize = "1024";
}else if(window.screen.width<1330){
RecommendedSize = "1280";
}else{
RecommendedSize = "1600";
}
var RecommendedSize = x;

function wallpaperRes(x)
{
document.getElementById(x).style.color = "#F90";
}

</script>

In the HTML, I've given each link an ID, such as "640", "800", "1024", etc, corresponding with the values of the ReccomendedSize variable above.

I think I have the right idea here, but how do I make this actually work? If only I knew what I was doing, eh.. ?

Thanks!

Vanessa










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  nested classes
•  Passing values from a select box to a text box
•  VBA MS Word Macro - Prompt # Tables, Copy + Paste # of Tables
•  view state
•  onBlur on textbox server control
•  Dropdown box values with different colors
•  Re: Shopping Cart -
•  Shopping cart
•  Altering Text Fields,


Recent Articles
Communicating with the Database (Using ADO)
MagicGrid
Simple Thumbnail Browsing Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2005