[JavaScript] JS div to remain visible

Laurent Muchacho LaurentM at london.virgin.net
Wed Jun 23 06:01:34 CDT 2004


Hi Alan,

just put this small statement to test what theDiv is in your toggle function


function toggle(theDiv) {
    if(theDiv){
		var elem = document.getElementById(theDiv);
		elem.style.display = (elem.style.display ==
"none")?"":"none";
	}
}

Please Alan sort out your HTML you will not go really far, if you have
really bad html. 
I did attach your file with the function fixed and I added some comment to
help you out with the html.



-----Original Message-----
From: Alan Easton [mailto:alaneaston666 at hotmail.com]
Sent: 23 June 2004 11:29
To: javascript at LaTech.edu
Subject: RE: [JavaScript] JS div to remain visible


Hi Laurent,

Thanks for the help yesterday.

I tried what you suggested and I now have 2 pages, just for testing, so I 
can navigate between the 2 and capture which layer was open.

But I am getting an error as I navigate from one to the other. Would you 
mind having a look to see where I have gone wrong. I am navigating from 
HTMLPage1.htm to HTMLPage12.htm.

It is when you launch the first page, HTMLPage1, because the onload event is

firing, but there is initially no 'divClicked' being passed, it is nothing 
and therefore the error is coming up.

Any help would be appreciated.

Thanks,

Alan...





>From: Laurent Muchacho <LaurentM at london.virgin.net>
>Reply-To: "[JavaScript List]" <javascript at LaTech.edu>
>To: "'[JavaScript List]'" <javascript at LaTech.edu>
>Subject: RE: [JavaScript] JS div to remain visible
>Date: Tue, 22 Jun 2004 18:06:49 +0100
>
>Hi Alan,
>
>The only way I know how to do this is by passing the value of which link as
>been pass through the querystring.
>I explain
>
>on your link <a 
>href="page2.asp?divClicked=name_or_id_of_your_div">Page2</a>
>
>after on the next page you either use ASP or Javascript to get the value
>from the querystring and populate a variable with the value
>
>ASP
>var myVariable = <%=request.querystring("divClicked")%>;
>
>Javascript
>var myVariable = QueryString('divClicked');
>this is the js function to get the querystring value
>function QueryString(param){
>	var loca = document.location.href;
>	if(loca.indexOf('?' + param + '=')>-1 || loca.indexOf('&' + param +
>'=')>-1){
>		var qString = loca.split('?');
>		var keyVal = qString[1].split('&');
>		for(var i=0;i<keyVal.length;i++){
>			if(keyVal[i].indexOf(param + '=')==0){
>				var val = keyVal[i].split('=');
>				return val[1];
>			}
>		}
>		return false;
>	}else{
>		return false;
>	}
>};
>
>
>then when the page load (I mean on the onload of the body like
>onload="toggle('myVariable ')") you can simply call your function
>
>et voila
>
>Laurent
>
>ps: I attached your file back with solution implemented unfornetely it will
>remenber only the one you had click at the end
>
>
>-----Original Message-----
>From: Alan Easton [mailto:alaneaston666 at hotmail.com]
>Sent: 22 June 2004 17:41
>To: javascript at LaTech.edu
>Subject: [Javascript] JS div to remain visible
>
>
>Hello People,
>
>I am in need of some help.
>
>I have a html page that has some div tags on. When you click each div tag,
>it toggles a table of links below it in another div tag to be either 
>visible
>
>or hidden.
>
>Now the problem I have it that when I click on one of the links in the 
>table
>
>that has been made visible, it goes to a page with the exact same 
>navigation
>
>structure on it, but I would like the table that was made visible to remain
>visible.
>
>Is there some way I can check to see which div tag has been made visible as
>I go to the link. I have attached the html file so you can see what I am
>doing.
>
>Any ideas or help would be grateful.
>
>Thanks,
>
>Alan...
>
>_________________________________________________________________
>Stay in touch with absent friends - get MSN Messenger
>http://www.msn.co.uk/messenger
>
>
>
>This E-mail and any files transmitted with it are confidential and intended

>solely for the use of the individual or entity to whom they are addressed.

>If you have received this E-mail in error please notify the system manager.

>  This message contains confidential information and is intended only for 
>the individual named.  If you are not the named addressee you should not 
>disseminate, distribute or copy this E-mail.
><< HTMLPage12.htm >>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo



This E-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed.  If you have received this E-mail in error please notify the system manager.  This message contains confidential information and is intended only for the individual named.  If you are not the named addressee you should not disseminate, distribute or copy this E-mail.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTMLPage1.htm
Type: application/octet-stream
Size: 3014 bytes
Desc: not available
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20040623/1d46f166/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTMLPage12.htm
Type: application/octet-stream
Size: 2193 bytes
Desc: not available
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20040623/1d46f166/attachment-0001.obj>


More information about the Javascript mailing list