kennr
kennr

Reputation: 65

html buttons work only someplaces on page?

I am successfully using html buttons for a NAV bar on the upper part of the html page and they work great there (transfer to the URL).

example syntax from upper page:

<button class="nav" type="button"
onclick="javascript:location.href='services_page.html'">
Services</button>

Problem: Then I am using more html buttons for an EXIT bar on bottom part of html page where they look great but do not activate (no transfer to URL).

example syntax from lower page:

<button class="bar" type="button" 
onclick="javascript:location.href='http://www.amazon.com/'">
Amazon.com</button>

The lower buttons do work when re-positioned near top of page? Tried, but just cannot get lower page buttons to work near bottom?

Upvotes: 1

Views: 132

Answers (1)

jafarbtech
jafarbtech

Reputation: 7015

Dont use javascript:.

just use location.href='http://www.amazon.com/'

Please check this, it works fine

<button class="bar" type="button" 
onclick="location.href='http://www.stackoverflow.com/'">
stackoverflow.com</button>

Upvotes: 1

Related Questions