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>


132.1 - 811,624
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
0
Would love your thoughts, please comment.x
()
x