Hey guys,
I'm absolutely newb when it comes to using javascript, so I'll need major help if you care to dish it
So I have a website where I can change some portion of it based on the pressing of a radio button:
So all that works fine and dandy..but is there a way of using more radio/checkbox buttons to have more variables?Code:<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.MyDiv').hide(); $('#divguy').show(); $('input[name="myRadio"]').click(function(){ var selected = $(this).val(); $('.MyDiv').slideUp(); $('#'+selected).slideDown(); }); }); </script> <p><b> I want to see a :</b> <input type="radio" name="myRadio" value="divfemaledog" checked />Female Dog <input type="radio" name="myRadio" value="divmaledog" />Male Dog </p> <div id="divfemaledog" class="MyDiv" style="background-color:#ADDFFF; height: 300px; width:600px;";> <h1>Images of Female Dogs!!</h1> </div> <div id="divmaledog" class="MyDiv" style="background-color:#F9B7FF; height: 300px; width:600px;"> <h1>Images of Male Dogs!!</h1> </div>
For instance, can I have a page that changes based on three variables: Female/Male Shorthaired/Longhaired Dog/Cat/Rabbit?
In this way, the default image would be Female shorthaired dogs, but someone can press male, and it would should male shorthaired dogs, and then someone could press rabbit and it would show male shorthaired rabbits?
Does this make sense? And is it possible?
Thanks



Reply With Quote
Bookmarks