Click to See Complete Forum and Search --> : Naming <Div> or <Span> Elements
gbeacock
01-06-2003, 02:26 PM
I'm creating an HTML version of a Family Tree complete with biography information, photo galleries, and anything else I can squeese in. Each section is written over top of each other and menu buttons are used to toggle the elements between 'visible' and 'hidden'.
After days of pulling my hair out, I have determined that the problem is in the naming of the <div> or <span> elements wrapped around each section. The below does not seem to be working. What am I doing wrong?
<span Class="basicStyle" ID = "basic">
Basic Information
</span>
Thanks - Gord the Mad Doctor
I can't see what your doing wrong with this little code, please post more of your code
gbeacock
01-06-2003, 06:00 PM
Here is a very abbreviated version of the relevant code. I just wish it worked. Probably something stupid. The hard parts seem to be working just fine. :D
<head>
function showPage(pageName) {
for (i=0; i<spanFamily.length; i++){;
var dom = document.getElementById(pageList[i]).style;
dom.visability =" hidden";
}
dom = document.getElementById(pageName).style;
dom.visability = "visable";
}
pageList = new Array("basic","family1","bio")
</head>
<body>
<A onClick="showPage( 'basic ')">
<IMG SRC="../../common/basic.gif" name="basicButton">
</A>
<span Class="basicStyle" ID = "basic">
Basic Information to be shown or hidden
</span>
</body>
Thanks - Gord the Mad Doctor
first I saw is:
dom.visability = "visable";
instead of:
dom.visibility = "visible";
AND:
<A onClick="showPage( 'basic ')"> // remove the space after basic
Next:
I would write <span class="basicStyle" id= "basic">
at least what's the spanFamily.length?
gbeacock
01-07-2003, 11:41 AM
Good proof reading. The 'a' in visable would have puzzled me later, but none of the elements are hidden when the function is called. The space with 'basic ' was a typo in my abreviated code.
I've put a skeleton set of the pages up at
http://ca.geocities.com/gbea****/FamilyTree/Bea****/WilliamK/index.html
There are three elements at present, all shown upon loading. (I'll change that later so that only the basic data can be seen) Clicking on a button should set everything as hidden, then show the page called. I really don't see why this doesn't work.
Thanks Gord - the Mad Doctor
You have many scripts for your websites. ;)
But I tell you, it's better to write some scripts yourself, because to find the error on the script will take more time then to write a simply crossbrowser show/hinding script.
gbeacock
01-08-2003, 12:51 PM
I wasn't getting error messages when I put it up. I'll go over it again, put in a bunch of alert boxes to reveal the relevant js created code, so it can be actually be read, then start the discussion over.
I'm using so much js to write the page because the available information for each person will be different for everyone. This is even more so since I am producing as complete a biography of everyone as possible. This way, each person gets a data.js file with all thier info. The index.js uses this file to build a page for them.
Menu.js is not my own script but borrowed from:
http://developer.netscape.com/viewsource/smith_menu/smith_menu.html
findDom.js is another borrowed script designed to determine the browser version and use the appropriate DOM. I've stopped calling it. If the family has any problems, I can put it back.
See you soon
Gord