0

I am very new and I am working on my website. My hosting service is IPage. When I try changing to a different section of the website with a button it doesn't work. Here is my code:

<button onclick='https://rgulewicz2438602.ipage.com/About.html'>About</button>
ScpteR
  • 1
  • 4
  • Good question, but please search before asking, there are several good answers to this question already. – Anuga Sep 22 '21 at 14:06

3 Answers3

1

onclick is call for a event, so u need put an action on him, not url. To redirect to another page you can use window.location, like this:

<button onclick='window.location="https://rgulewicz2438602.ipage.com/About.html"'>About</button>
naxsi
  • 602
  • 3
  • 15
1

You should use an anchor tag to change the location of a page, like so:

<a class="btn" href='https://rgulewicz2438602.ipage.com/About.html'>About</a>

then you can style it using css to look like a button

some example styles might be something like:

.btn {
  display: inline-block;
  padding: 4px 8px;
  background: tomato;
  color: white;
  text-decoration: none;
}
Joe Lissner
  • 2,181
  • 1
  • 15
  • 21
0

To open a site use either window.open with JavaScript or better still use a link which has an attribute of target="_blank"

Try this:

a {
  background: #aaf;
  border: 1px solid #000;
  border-radius: 3px;
  color: #000;
  padding: 4px;
}
a:hover {
  background: #ddf;
}
a:active {
  background: #aaf;
}
<a href="https://rgulewicz2438602.ipage.com/About.html">About</a>
Krokodil
  • 1,165
  • 5
  • 19