Image visibility in IE

J

Justin Wright

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="JavaScript">
<!--
function updateReq( ) {
if( document.testForm.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="requireName" onchange="javascript:
updateReq();" checked>Name Required
<br>
<img name="req_Name" id="req_Name"
src="includes/images/required.jpg">Name:<input name="Name" type="text"
size=25 maxlength=50>
</form>

</body>
</html>
 
B

Brett Merkey

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?
<input type="checkbox" name="requireName" onchange="javascript:
updateReq();" checked>Name Required

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Staff online

Members online

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top