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





© Copyright codetoad.com 2001-2005