onclick = open page in new window


A couple of pieces of code I have been trying to use today:

This one creates a button, which when clicked, opens a new page in the same window.

    <form><input onclick=”location.href=(‘https://www.abcdiamond.com’)” type=”button” value=”Details of link…” /></form>

This next one creates a button, which when clicked, opens a new page in a NEW window.

    <form><input onclick=”window.open(‘https://www.abcdiamond.com’)” type=”button” value=”Details of link…” />

This next one creates a button, which when clicked, closes the current window.

    <form method=”post”><input onclick=”window.close()” type=”button” value=”Close this Window” /></form>

To centre these buttons in a table, the code <center> must be placed after the code <form>.

    <form><p align=”center”><input onclick=”location.href=(‘https://www.abcdiamond.com’)” type=”button” value=”Details of link…” /></form>


103.1 - 605,752
Scroll down for Comments
0 0 votes
Article Rating
Subscribe
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments