# Javascript woes

**URL:** <https://boards.straightdope.com/t/javascript-woes/125808>\
**Category:** Factual Questions\
**Created:** [August 27, 2002, 6:37pm UTC](https://boards.straightdope.com/t/javascript-woes/125808 "2002-08-27T18:37:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [August 27, 2002, 6:37pm UTC](https://boards.straightdope.com/t/javascript-woes/125808/1 "2002-08-27T18:37:34Z")

</div>

I’m having a little javascript trouble, and was hoping someone could toss me a clue. Here’s my code:

```auto

<html><head><title>Test Page</title>		

<script>function first(){divsecond.style.visibility = 'visible';}</script>

</head>
	
<body><p>Test form...let's see if this works.</p>
		
<form name="testform" action="test.html" method="get">
<select name="first" onChange="first();">
<option></option>
<option value="1">One</option>
<option value="2">Two</option>
</select>
<div id="divsecond" style="visibility:hidden">
<label for="divsecond">
<select name="second"></select></label></div></form>
	
</body></html>

```

Note that this is not how I’d normally write code; I’ve just condensed it to make it shorter.

The problem is with the onChange modifying that first select tag. It won’t let me use my own functions with it. If I were to change that to document.forms.testform.submit(), it’d work just fine. As is, it tells me that the object doesn’t support this property or method–but it does, goshdarnit!

Any light to shed on this?

---

<div class="post-metadata">

**Author:** ![Armilla](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@Armilla](https://boards.straightdope.com/u/Armilla)\
**Post date:** [August 27, 2002, 7:22pm UTC](https://boards.straightdope.com/t/javascript-woes/125808/2 "2002-08-27T19:22:13Z")

</div>

Maybe it’s because the name of the select tag and the name of the function are the same? Try calling the function something else.

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [August 27, 2002, 7:28pm UTC](https://boards.straightdope.com/t/javascript-woes/125808/3 "2002-08-27T19:28:09Z")

</div>

Huh…damned if it doesn’t work. Well, there’s one mystery cleared up. Thanks a bunch, **Armilla** , and welcome to the board!
