Browser Detection and Styling

  • Howdy_McGee
  • Novice
  • Novice
  • No Avatar
  • Joined: Jun 22, 2010
  • Posts: 16
  • Status: Offline

Post June 29th, 2010, 6:01 pm

Ok, so i'm trying to add replace styling of a certain ID in Wordpress using a javascript Browser detection script i'm writing. saying IF the user is using Internet Explorer make this paragraph blue. It doesn't work though for some reason hopefully someone can spot my error.
Code: [ Select ]
<script type="text/javascript">
<!--
var element=document.getElementById("monthlyPara");
if (navigator.appName=="Microsoft Internet Explorer")
{
     element.style.color="blue";
}
-->
</script>
  1. <script type="text/javascript">
  2. <!--
  3. var element=document.getElementById("monthlyPara");
  4. if (navigator.appName=="Microsoft Internet Explorer")
  5. {
  6.      element.style.color="blue";
  7. }
  8. -->
  9. </script>
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post June 29th, 2010, 6:01 pm

  • joebert
  • Sledgehammer
  • Genius
  • No Avatar
  • Joined: Feb 10, 2004
  • Posts: 13458
  • Loc: Florida
  • Status: Offline

Post June 29th, 2010, 10:41 pm

Are you aware of conditional comments ?
http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx
Strong with this one, the sudo is.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 130 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.