Elements can not have numeric ID's or id's which start with numbers.
change your ID's to this format of:
<div id="div1">
Then use:
document.getElementById("div" + (divCount+1)).className ='hiddenDiv';
and so on...
On Jan 13, 8:56 am, geoffcox <[email protected]> wrote:
> Hello
>
> the code below works fine in IE but will only work in latest Firefox
> if I remove the link to the prototype js file. Form 2 radio buttons do
> not appear after selecting a button for Form 1.
>
> Of course the ajax updater does not work then!
>
> Any ideas please!
>
> Geoff
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <title>WM</title>
>
> <script src="assets/javascripts/prototype-1.6.0.3.js" type="text/
> javascript">
> </script>
>
> <style>
> .visibleDiv {
> display : block}
>
> .hiddenDiv {
> display : none}
>
> </style>
>
> <script type="text/javascript">
>
> var results = [];
> var divCount = 0;
>
> function sendResults() {
>
> var params = ({
> section1: results[0],
> section2: results[1],
> section3: results[2]
>
> });
>
> new Ajax.Updater(
> 'updateDiv',
> 'wm-send.php',
> {
> asynchronous:true,
> method:'post',
> parameters: params
> }
> );
>
> }
>
> function getValue(form) {
>
> var radioName = form.elements[0].name;
> var typeValue = form[radioName];
>
> if(typeValue) {
> for(var i=0, n=typeValue.length; n>i; i++) {
> if(typeValue[i].checked) {
> results[divCount] = typeValue[i].value;
> }
> }
>
> }
>
> if (divCount < 2) {
> document.getElementById(divCount+1).className ='hiddenDiv';
> document.getElementById(divCount+2).className ='visibleDiv';
> divCount++;} else {
>
> document.getElementById(divCount+1).className ='hiddenDiv';
> sendResults();
>
> }
> }
>
> </script>
> </head>
>
> <body>
>
> <div id="1" class="visibleDiv">
> form1
> <form name="myform1" action="#">
> <input type="radio" name="picNum1" value="1">
> <input type="radio" name="picNum1" value="2">
> <input type="radio" name="picNum1" value="3">
> <input type="button" name="button" value="Send"
> onClick="getValue(this.form);">
> </form>
> </div>
>
> <div id="2" class="hiddenDiv">
> form2
> <form name="myform2" action="#">
> <input type="radio" name="picNum2" value="1">
> <input type="radio" name="picNum2" value="2">
> <input type="radio" name="picNum2" value="3">
> <input type="button" name="button" value="Send"
> onClick="getValue(this.form);">
> </form>
> </div>
>
> <div id="3" class="hiddenDiv">
> form3
> <form name="myform3" action="#">
> <input type="radio" name="picNum3" value="1">
> <input type="radio" name="picNum3" value="2">
> <input type="radio" name="picNum3" value="3">
> <input type="button" name="button" value="Send"
> onClick="getValue(this.form);">
> </form>
> </div>
>
> <div id="updateDiv"></div>
>
> </body>
> </html>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---