/    Sign up×
Community /Pin to ProfileBookmark

Loss of Button Function Within Onload Script

I cannot figure out why navigation panel buttons are losing CSS formatting and their function as HTML buttons.

The page markup (in [B]index.html[/B]) is here:

[url]http://proteomics.dynalias.org/Tests/Regena/[/url]

There is one external [B]CSS[/B] and one external [B]JS[/B] file that contains all the

I have traced the problem to a single Javascript line during the initialization (first loading) of the document.

[CODE]
61: contentPanel.replaceChild(content, contentPanel.firstChild);
[/CODE]

This is line 61 in the function [B]jumpToPage()[/B] in the ncluded external Javascript file [B]ReGenaVetLabs.js[/B]

Up to this script statement, the buttons are active and the mouse cursor shows as a pointer. After it executes, the cursor is no longer a pointer, and the buttons not clickable.

It does not make sense to me why the left-side navigation buttons should be affected.

===================================
MORE INFORMATION

The page layout has four parts:

  • 1. top panel (constant)

  • 2. left-sided middle panel for navigation with buttons (constant)

  • 3. right-sided middle panel for content

  • 4. bottom panel (constant)
  • “(constant)” means it does not change from page to page.

    Although there is only one physical page—which is index.html in this setup—the content is loaded using scripts: the page is full of text and images that are contained inside DIV elements whose display is turned off (style=”display:none;”) and the DIV content is loaded using Javascript, simply by using the DOM [B].replaceChild()[/B] method for the DIV element that makes contains panel labeled 3 above…the content panel.

    Later on, I will make each page a separate HTML page, to deal with browsers whose script use is deliberately disabled. But this development is easier for me, and it avoids the new page loading appearance: browser window clears, browser loads wanted page.

    to post a comment
    JavaScript

    1 Comments(s)

    Copy linkTweet thisAlerts:
    @senisevenauthorApr 29.2011 — I seemed to have solved it.

    The layout for this page is basically a container inside the document body that centers in the page 'fluidly' (left and right margins set to 'auto' in CSS).

    This container then contains the four panels that make up the page. The top, left-middle, and bottom don't change between page to page. The right-middle is the content that changes.

    The left- and right-middle panels make up maybe 70-80% of the height. And the left-middle, containing the navigation buttons/menu is FLOATED to the left. The right-middle content panel thus flows around it. The leftside floated panel with nav buttons has a set width of 11em.

    Now when changing the right middle content panel dynamically using the .replaceChild() method, it affects the style and possibly z-level of the leftside floated left-middle panel with its navigation buttons.

    The solution was to set margin-left of the right-middle panel to be equal to the width of the left-middle floated panel.

    This is not required if the page is loaded and its DOM structure is not dynamically altered. But it happens if dynamic page re-structuring occurs.

    I am still at a loss to explain it. It just happened to work because I was trying to fix something else, and then found I had solved this problem too.

    This problem did NOT occur because of invalidated markup in either HTML or CSS. These were always valid. I know that many problems arise often because of invalid markup/coding, and many problems are solved when markup is edited to make it valid.

    It should be added that this problem was also browser-dependent. This problem was seen in FF4, but not in IE9. I am guessing that FF4 has a quirk in it, because IE9 behaved in the expected manner.
    ×

    Success!

    Help @seniseven spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.18,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @AriseFacilitySolutions09,
    tipped: article
    amount: 1000 SATS,

    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,
    )...