[thelist] DIV InnerHTML,JavaScript, and Forms...

Cymbala, Greg Greg.Cymbala at Den.Galileo.com
Fri May 31 13:28:01 CDT 2002


How about instead of creating the form elements on the fly, hard-code them,
but make the DIVs visible/invisible using something like ...

function showDIV(divName){
	if(document.getElementById) {
		document.getElementById(divName).style.display = 'block';
		document.getElementById(divName).style.visibility='visible';
	}
	else if(document.layers) {
		for (i=0; i < document.layers.length; i++) {
			var whichEl = document.layers[i];

			if (whichEl.id.indexOf(divName) != -1) {
				whichEl.visibility='show';
			}
			arrange();
		}

		document.layers[divName].visibility='show';
		arrange();
	}
	else if(document.all) {
		document.all(divName).style.display = 'block';
		document.all(divName).style.visibility='visible';
	}
}

function hideDIV(divName){
	if(document.getElementById) {
		document.getElementById(divName).style.visibility='hidden';
		document.getElementById(divName).style.display = 'none';
	}
	else if(document.layers) {
		for (i=0; i < document.layers.length; i++) {
			var whichEl = document.layers[i];

			if (whichEl.id.indexOf(divName) != -1) {
				whichEl.display = 'none';
				whichEl.visibility='hide';
			}
			arrange();
		}

		document.layers[divName].display = 'none';
		document.layers[divName].visibility='hide';

	}
	else if(document.all) {
		document.layers[divName].display = 'none';
		document.all(divName).style.visibility='hidden';
	}
}

-----Original Message-----
From: Eric Langlitz [mailto:elanglitz at b-d-g.com]
Sent: Friday, May 31, 2002 11:24 AM
To: thelist at lists.evolt.org
Subject: [thelist] DIV InnerHTML,JavaScript, and Forms...


--
[ Picked text/plain from multipart/alternative ]
Hey everyone, here is a stumper (for me anyhow...).  I am working on a form,
that contains <div> areas that are not visible to start with (ex: <div
id=²butter²>&nbsp;</div> ).  When a user chooses the correct button, etc, a
.js function replaces the blank area with a form field via innerHTML (ex:

Function changeMe(){
Document.all.butter.innerHTML = ³form field html here = Œstuff¹ and more
html² }

Now, I know that innerHTML is a bastard in Netscape, which I really don¹t
need to address.  The problem is, the form shows up and works great, but I
cannot capture the form elements in this <div> when I submit the form.   I
can only guess this is because they really don¹t exist on the page...

Any one have a solution or thoughts?

- Thanks!


The information in this electronic mail message is sender’s business
Confidential and may be legally privileged.  It is intended solely for the
addressee(s).  Access to this Internet electronic mail message by anyone
else is unauthorized.  If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful.
The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during  transmission. By reading
the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects. Galileo International is not liable for any loss or damage
arising in any way from this message or its attachments.





More information about the thelist mailing list