Jump to content

Changing element class

- - - - -

  • Please log in to reply
3 replies to this topic

#1
sAuhsoj

sAuhsoj

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
Why is it that the following does not seem to do anything:
<script type="text/javascript">
if (document.width <= 1200)
{
document.getElementById("linkbox").className = "linkboxsmall";
}
</script>
the class linkboxsmall shows the linkbox mostly off screen so it is less intrusive. But this class change doesn't seem to happen in firefox or other browsers. It does work in chrome.
The page is bambi4.co.uk/programs/gest

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Have you tried using FireBug plugin for Firefox, to see what's happening? Note: I can't find the code you used anywhere on the linked page.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
sAuhsoj

sAuhsoj

    Learning Programmer

  • Members
  • PipPipPip
  • 41 posts
I have updated new code and am testing it now.

---------- Post added at 07:50 PM ---------- Previous post was at 06:01 PM ----------

That seems to have fixed it. does it work for you?

#4
Vaielab

Vaielab

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 547 posts
Yes it work (under ubuntu firefox 5.0)




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users