0

I have some text which I'd like to be clickable. And I want the picture to be opened when I click the certain word in a new window (not in a new tab). How could I do that? The code below does not work.

<p>Click on the <a href = "./images/TheForm.jpg">"Request Access"</a> button and fill in the form.</p>
Anthony
  • 61
  • 4

2 Answers2

0

Just add a target="_blank" to your link if you want to open the destination of a link in a new tab:

<a href = "./images/TheForm.jpg" target="_blank">Request Access</a>

And define a onClick method to open it in a window :

<a href="./images/TheForm.jpg"  
    onclick="window.open('./images/TheForm.jpg', 
                         'windowName', 
                         'width=800, height=600'); 
              return false;"
 >Request Access</a>

When you specify the width/height, it'll open the link in a new window instead of a tab.

Here is the documentation for further information.

0
<a href="IMAGE_URL" target="_blank">
  <img alt='img_path' class='img-40 rounded-circle' src='IMAGE_URL' />
</a>
Amr yasser
  • 74
  • 1
  • 7
  • I don't wanna make a link from the pic. I wanna click on the text and open the pic in a new window(not tab). – Anthony Jan 04 '22 at 13:51
  • then you will need to use target="_blank" and the new tab is a new window what is the difference between tab and window? – Amr yasser Jan 04 '22 at 14:26