Posted by Jonathan N. Little on 10/11/65 11:54
JMcC wrote:
> hello,
>
> Im trying to do a wee trick with drop down lists. Im creating a form
> with 4 drop down lists on it that a user has to fill in. I dont want
> to overwhelm the user so what I want is when the page loads up only 1
> drop down list is present and then when a selection is made in that
> list the next drop down list appears. To do this I was looking into
> using a JavaScript function but I keep running into an error and im not
> to sure how to fix it. Could someone please take a look at this code
> and see if they can help.. Thanks and regards
Well I question the usefulness but you have a real DOM error here.
>
> <html>
> <head>
> <title>test</title>
> <style>
> .vis1 { visibility:visible }
> .vis2 { visibility:hidden }
> </style>
>
> <script type = "text/javascript">
> <!-- Hide JavaScript from older browsers
>
> function make_visible(id_no)
> {
> drop = document.getElementById(id_no);
> drop.class="vis1";
that is drop.className not drop.class
also it is a good idea to limit the scope of variables in functions, use
the 'var' keyword
var drop = document.getElementById(id_no);
else drop is global and can lead to nasty debugging issues.
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|