G
GarryJones
Can I nest javascript to open a hidden DIV tag on a DIV tag that is
itself opened by javascript?
I have a javascript to decide which DIV tag is visible. (Code A)
In one of these DIV tags (mck04) I have a button to show a hidden
form. (Code B)
Code B works stand alone on its on html page but I get "element not
found" when I place the link to it in another DIV tag which in itself
is opened by Code A.
Code A
***************************************************************
var ids=new Array('mck01','mck02','mck03','mck04','mck05');
function switchid(id){
hideallids();
showdiv(id);
}
function hideallids(){
for (var i=0;i<ids.length;i++){
hidediv(ids);
}
}
function hidediv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'none';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'none';
}
else { // IE 4
document.all.id.style.display = 'none';
}
}
}
function showdiv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'block';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'block';
}
else { // IE 4
document.all.id.style.display = 'block';
}
}
}
*****************************
This is Code B
function InsertContent(tid) {
if(document.getElementById(tid).style.display == "none") {
document.getElementById(tid).style.display = "";
}
else {
document.getElementById(tid).style.display = "none";
}
}
**********************************
This is the code to show the mck04 tag
<a href="javascript:switchid('mck04');">Details</A>
The mck04 div is displayed and in it I have some details of a sporting
event. The idea is if they want to sign up they open the form (show1)
whilst remaining within the mck04 tag.
<div id="show1" style="display: none">
(The form code is here)
</div>
This is the link within DIV mck04 which should open show1
<a href="javascript:InsertContent('show1');">Click here to sign up</a>
Any help greatly appreciated
Garry Jones
Sweden
itself opened by javascript?
I have a javascript to decide which DIV tag is visible. (Code A)
In one of these DIV tags (mck04) I have a button to show a hidden
form. (Code B)
Code B works stand alone on its on html page but I get "element not
found" when I place the link to it in another DIV tag which in itself
is opened by Code A.
Code A
***************************************************************
var ids=new Array('mck01','mck02','mck03','mck04','mck05');
function switchid(id){
hideallids();
showdiv(id);
}
function hideallids(){
for (var i=0;i<ids.length;i++){
hidediv(ids);
}
}
function hidediv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'none';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'none';
}
else { // IE 4
document.all.id.style.display = 'none';
}
}
}
function showdiv(id) {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(id).style.display = 'block';
}
else {
if (document.layers) { // Netscape 4
document.id.display = 'block';
}
else { // IE 4
document.all.id.style.display = 'block';
}
}
}
*****************************
This is Code B
function InsertContent(tid) {
if(document.getElementById(tid).style.display == "none") {
document.getElementById(tid).style.display = "";
}
else {
document.getElementById(tid).style.display = "none";
}
}
**********************************
This is the code to show the mck04 tag
<a href="javascript:switchid('mck04');">Details</A>
The mck04 div is displayed and in it I have some details of a sporting
event. The idea is if they want to sign up they open the form (show1)
whilst remaining within the mck04 tag.
<div id="show1" style="display: none">
(The form code is here)
</div>
This is the link within DIV mck04 which should open show1
<a href="javascript:InsertContent('show1');">Click here to sign up</a>
Any help greatly appreciated
Garry Jones
Sweden