Hi
I have web page, with 3 radio buttons. Clicking on either will display 1 of 3 different forms.
I've got some javascript in my head tag, and then got "onClick" code on the radio buttons, then the 3 forms are each surrounded by div tags. It all works.
But I want to show and hide 2 tables in one of these forms.
Any ideas if I can have more of these div tags within the form div tags?
Its not working so far....
the code is shown below....I'm only showing selected bits form the page:
Javascript code in head tags:
In my body tags I have 3 separate forms - each enclosed within <div id...> tags. Beofore the first form div tag I have 3 radio buttons which are linked to the 3 forms.
Therefore the overview of the code is:
- radio button code where user will choosethe form:
- 1st form div tag:
- 2nd form div tag:
- 3rd form - THE BIT I NEED HELP WITH. In this 3rd form, I want to implement the showing/hiding layers functionality. So its nested within the div tag so to speak.
I have the usual form tag, and then some input fields as well.
However, one particular drop down list needs to show/hide 2 different tables. I was thinking of having separate div tags around the 2 tables, and then have the div id's in the head code as you can see above:
Therefore the code I has so far in this 3rd form for a particluar option is:
and then underneath I have 2 tables each with 2 div tags:
repeat for 2nd table as well.
The main 3 forms work as they should. But the nested functionality with the drop down list does not. I can select the option, but the table code does not hide or show as it should.
Any ideas please?? I would really appreciate any help on this.....
I have found a lot of info on showing / hiding divs, but not showing/hiding data nested in one of these divs (if that makes sense?!?!)
Thanks![[pipe] [pipe] [pipe]](/data/assets/smilies/pipe.gif)
I have web page, with 3 radio buttons. Clicking on either will display 1 of 3 different forms.
I've got some javascript in my head tag, and then got "onClick" code on the radio buttons, then the 3 forms are each surrounded by div tags. It all works.
But I want to show and hide 2 tables in one of these forms.
Any ideas if I can have more of these div tags within the form div tags?
Its not working so far....
the code is shown below....I'm only showing selected bits form the page:
Javascript code in head tags:
Code:
<script type="text/javascript">
<!--
function changeDiv(the_div,the_change)
{
var the_style = getStyleObject(the_div);
if (the_style != false)
{
the_style.display = the_change;
}
}
function hideAll()
{
changeDiv("standalone","none");
changeDiv("server","none");
changeDiv("concurrent","none");
changeDiv("ProjectRisk","none");
changeDiv("RiskExpert","none");
}
function getStyleObject(objectId) {
if (document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId).style;
} else if (document.all && document.all(objectId)) {
return document.all(objectId).style;
} else {
return false;
}
}
// -->
</script>
In my body tags I have 3 separate forms - each enclosed within <div id...> tags. Beofore the first form div tag I have 3 radio buttons which are linked to the 3 forms.
Therefore the overview of the code is:
- radio button code where user will choosethe form:
Code:
<input type="radio" name="pet" onClick="hideAll(); changeDiv('standalone','block');" checked>Standalone Licence
<input type="radio" name="pet" onClick="hideAll(); changeDiv('server','block');">Server-named Licence
<input type="radio" name="pet" onClick="hideAll(); changeDiv('concurrent','block');">Concurrent Licence
- 1st form div tag:
Code:
<div id="standalone" style="margin:5px;display:block">
.... FORM CODE - normal stuff
</div>
- 2nd form div tag:
Code:
<div id="server" style="margin:5px;display:none">
...form code
</div>
- 3rd form - THE BIT I NEED HELP WITH. In this 3rd form, I want to implement the showing/hiding layers functionality. So its nested within the div tag so to speak.
I have the usual form tag, and then some input fields as well.
However, one particular drop down list needs to show/hide 2 different tables. I was thinking of having separate div tags around the 2 tables, and then have the div id's in the head code as you can see above:
Code:
changeDiv("ProjectRisk","none");
changeDiv("RiskExpert","none");
Therefore the code I has so far in this 3rd form for a particluar option is:
Code:
<select name="software">
<Option value="ProjectRisk" onClick="hideAll(); changeDiv('ProjectRisk','block');">Project Risk</Option>
<Option value="RiskExpert" onClick="hideAll(); changeDiv('concurrent','block');">Risk Expert</Option>
</select>
and then underneath I have 2 tables each with 2 div tags:
Code:
<div id="ProjectRisk" style="margin:5px;display:block">
1st table goes here
</div>
repeat for 2nd table as well.
The main 3 forms work as they should. But the nested functionality with the drop down list does not. I can select the option, but the table code does not hide or show as it should.
Any ideas please?? I would really appreciate any help on this.....
I have found a lot of info on showing / hiding divs, but not showing/hiding data nested in one of these divs (if that makes sense?!?!)
Thanks
![[pipe] [pipe] [pipe]](/data/assets/smilies/pipe.gif)