How jump inside page?

R

robertbaer

I have tried many variations of this and all are nogo (no jump).
It would seem that (somehow) i need to force the browser to
scan/pre-scan the full markup before execution.

** sample: how can i make it work?

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<!-- sample Does NOT go to "skipp" -->
<div class="grid_13 padtop">
<h3>"Get in Touch"..</h3>

<script>
window.location.replace('s.html#skipp');
</script>

<form id="contact-form">
<div class="success"> Contact form submitted!<br> <strong>We will
be in touch soon.</strong></div>
<fieldset>
<label class="name">
<input type="text" value="Name:">
<span class="error">*This is not a valid name.</span>
<span class="empty">*This field is required.</span>
<span class="clear"></span>
</label>
<label class="email">
<input type="text" value="E-mail:">
<span class="error">*This is not a valid email address.</span>
<span class="empty">*This field is required.</span>
<span class="clear"></span>
</label>
<label class="phone">
<input type="text" value="Phone:">
<span class="error">*This is not a valid phone number.</span>
<span class="empty">*This field is required.</span>
<span class="clear"></span>
</label>
<label class="message">
<textarea>Message:</textarea>
<span class="error">*The message is too short.</span>
<span class="empty">*This field is required.</span>
<span class="clear"></span>
</label>
<div class="buttons"><span><a class="button"
data-type="reset">Clear</a></span>
<span><a class="button"
data-type="submit">Submit</a></span></div>
</fieldset>
</form>
<br>
<a name="skipp">This is after form.<br> </a>
</div>
</body>
</html>
 
E

Ed Black

I have tried many variations of this and all are nogo (no jump).
It would seem that (somehow) i need to force the browser to
scan/pre-scan the full markup before execution.

It works, but will not be apparent with the code you provided because
insufficient space is provided below the targeted anchor for the
browser to show it at the top of the viewport.

To demonstrate this, add the following CSS to pad out the body at the bottom.

body {padding-bottom:1000px;}
 
J

Jonathan N. Little

I have tried many variations of this and all are nogo (no jump).
It would seem that (somehow) i need to force the browser to
scan/pre-scan the full markup before execution.

** sample: how can i make it work?

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
<!-- sample Does NOT go to "skipp" -->
<div class="grid_13 padtop">
<h3>"Get in Touch"..</h3>

<script>
window.location.replace('s.html#skipp');
</script>

In addition yo what Ed wrote, your inline script is ABOVE your anchor,
so it will fail because the anchor "skipp" does not exist in the DOM yet
when it fires. You have two options. Either attache the function to the
windows's onload event guaranteeing which fires after the whole page is
loaded insuring "skipp" exists. Or place the inline script in the
document AFTER the anchor markup.
 
R

robertbaer

Jonathan said:
In addition yo what Ed wrote, your inline script is ABOVE your anchor,
so it will fail because the anchor "skipp" does not exist in the DOM yet
when it fires. You have two options. Either attache the function to the
windows's onload event guaranteeing which fires after the whole page is
loaded insuring "skipp" exists. Or place the inline script in the
document AFTER the anchor markup.
Well,fussing with the onload made no difference, and it seems to make
no sense to have the browser scan and render all the way down to the
"jump" script to make it go back up and thus endlessly repeat.
Will have to think of another way to get this cat out of its skin..
 
J

Jonathan N. Little

Well,fussing with the onload made no difference, and it seems to make
no sense to have the browser scan and render all the way down to the
"jump" script to make it go back up and thus endlessly repeat.
Will have to think of another way to get this cat out of its skin..

Well maybe if you supplied a URL to the page, we might be able to spot
was your are doing wrong.
 
R

robertbaer

Jonathan said:
Well maybe if you supplied a URL to the page, we might be able to spot
was your are doing wrong.
Thanks for the offer..in effect i have a new cat, complete with skin
and fur.
 
Joined
Oct 13, 2012
Messages
6
Reaction score
0
HTML Jump

<a href="#City">

and then the target in the code where the jump target is:

<a name="City">

Regards - patriic48
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top