Image visibility in IE

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Justin Wright

    Image visibility in IE

    Greetings -

    I am trying to set up a page where there are a couple of checkboxes, and
    based on the selected checkbox, certain input fields are required. For the
    required fields, I want to display a red asterick as an image (
    required.jpg ) next to the field iteslf. Thus, I am trying to write a
    JavaScript function that will get called via the "onchange" action for each
    checkbox.... this function willl either set the visibility to "visible" or
    "hidden" for the red asterick ( required.jpg ) next to each input ( name,
    address, email, etc... ). I am able to get this working in Netscape (
    7.02 ), however I can't seem to get it to work for Internet Explorer (
    6.02 ).

    Here is a trimmed down, working ( at least in Netscape ) sample of what I am
    trying to do. Any idea on what I need to do differently to get this to work
    in IE?

    Any help is appreciated. Thanks,
    Jusitn

    ---------------------------------------------------------------------


    <html>
    <head>
    <title>Test</title>
    <script language="JavaS cript">
    <!--
    function updateReq( ) {
    if( document.testFo rm.requireName. checked ) {
    document.images .req_Name.style .visibility = "visible";
    } else {
    document.images .req_Name.style .visibility = "hidden";
    }
    }
    //-->
    </script>
    </head>

    <body>

    <form name="testForm" >
    <input type="checkbox" name="requireNa me" onchange="javas cript:
    updateReq();" checked>Name Required
    <br>
    <img name="req_Name" id="req_Name"
    src="includes/images/required.jpg">N ame:<input name="Name" type="text"
    size=25 maxlength=50>
    </form>

    </body>
    </html>




  • Brett Merkey

    #2
    Re: Image visibility in IE

    > Here is a trimmed down, working ( at least in Netscape ) sample of what I
    am[color=blue]
    > trying to do. Any idea on what I need to do differently to get this to[/color]
    work[color=blue]
    > in IE?
    > <input type="checkbox" name="requireNa me" onchange="javas cript:
    > updateReq();" checked>Name Required[/color]

    IE is not registering the onchange event for the checkbox. Onclick works
    fine.



    Comment

    • JW

      #3
      Re: Image visibility in IE

      onclick is what I needed....I must've had a brain fart there... thanks!

      "Brett Merkey" <bmerkey@tampab ay.rr.com> wrote in message
      news:PoBVb.8849 8$fH2.13485@twi ster.tampabay.r r.com...[color=blue][color=green]
      > > Here is a trimmed down, working ( at least in Netscape ) sample of what[/color][/color]
      I[color=blue]
      > am[color=green]
      > > trying to do. Any idea on what I need to do differently to get this to[/color]
      > work[color=green]
      > > in IE?
      > > <input type="checkbox" name="requireNa me" onchange="javas cript:
      > > updateReq();" checked>Name Required[/color]
      >
      > IE is not registering the onchange event for the checkbox. Onclick works
      > fine.
      >
      >
      >[/color]


      Comment

      Working...