Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    45
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conditional loading of a graphic

    Hi

    Im using the following function to determine the operating system, however i want to supress loading of graphics if the OS is CE

    function checkOS() {
    if(navigator.userAgent.indexOf('CE') != -1)
    { var OpSys = "CE"; }
    else { var OpSys = "WIN"; }
    return OpSys;
    }

    what im looking for is something like

    if checkOS = "WIN"
    <img src= ... etc
    else
    &nbsp;
    end if

    its just the syntax im looking for really, and its got to run on a straight html page not asp.

    Thanks

    Steve.

  • #2
    Senior Coder
    Join Date
    Nov 2006
    Posts
    1,000
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try

    Code:
    <body>
      <script type="text/javascript">
        if (checkOS() == "WIN") {
          document.write("<img src= ... etc>");
        } else {
          document.write("&nbsp");
        }
      </script>
    </body>
    david_kw


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •