/    Sign up×
Community /Pin to ProfileBookmark

JS Layer Position Problem on Show

I have a form divided into virtual layers that are alternately visible and hidden. I move between layers using buttons according to the following code:

[CODE]<input type=”button” id=”B1″ value=”Go Back” onClick=”showLayer(‘page2’)”>
<input type=”button” id=”C2″ value=”Continue” onClick=”showLayer(‘page3’)”>[/CODE]

When I click either button, it moves me to the correct layer, but always to the same position on the page as the cursor was last. In other words, if I was 550px down the page when I clicked “Continue,” the next layer opens at 550px down the screen. As the content of some layers is only a few px high, you have to scroll up to see the content. This is fine for me as I know there is something on the page, but for a visitor to the form, they will think they clicked through to a blank page and shut down.

[B]How do I get it to open at the top of the next layer?[/B]

The layers are created by <div> tags with “page” style defined by css as follows:

[CODE].page{
position: absolute;
top: 10;
left: 100;
visibility: hidden;[/CODE]

I tried adding hyperlinks (#name) between the buttons and the top of each page and using display: block, but neither has any effect.

Any ideas?!

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @kazzandra 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.6,
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,
)...