Browser Detection and Styling

  • Howdy_McGee
  • Novice
  • Novice
  • Howdy_McGee
  • Posts: 16

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • joebert
  • Fart Bubbles
  • Genius
  • User avatar
  • Posts: 13502
  • Loc: Florida

Post 3+ Months Ago

Are you aware of conditional comments ?
http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 93 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.