I am trying to teach myself JavaScript. I have tried using online tutorials, but I am not prepared for this kind of error. I am trying to have a tablerow appear when a checkbox is selected. The name of the tablerow is generated dynamically by PHP. My code is:
Unfortunately, I keep getting an "object required" error on the line with
Any ideas? Thanks in advance for your help!
<head>
<script type="text/javascript">
function showhide(box,id) {
var elm = document.getElementById(id)
elm.style.display = box.checked? "table-row":"none"
}
</script>
//Down in the body:
<insert type="checkbox" name="v1[]" value=$vname onclick="showhide(this,$vname)">Unfortunately, I keep getting an "object required" error on the line with
elm.style.display = box.checked? "table-row":"none"
Any ideas? Thanks in advance for your help!

Help
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Back to top








