WsMom
WsMom

Reputation: 51

How to open a link in a pop up iframe window

I have text that I need to link to where you click on it and an iframe window pops up with the content from an external site. I have found code that when I use it, a box appears above the text and the content shows in the box when clicked. But I need it to not show anything until the link is clicked.

<iframe name="book" src="https://www.timetrade.com/book/9PK2K"></iframe>
<a href='https://www.timetrade.com/book/9PK2K' target="book">Book Now!</a>

This is the code I used to try to get it to link to a pop up iframe window but it showed a box above the text.

enter image description here

Upvotes: 0

Views: 9407

Answers (1)

user4577662
user4577662

Reputation:

You'll need to use some javascript for this.

A simple onClick() method that sets the display to 'Block' and 'None' to display and hide, respectively, should do the trick.

The javascript would set style.display="none" by default, and the onClick will be written to set style.display="block" or some un-hidden attribute.

Check out this http://www.w3schools.com/jsref/event_onclick.asp for onClick and http://www.w3schools.com/jsref/prop_style_display.asp for using javascript to show/hide DOM objects.

Good luck!

Upvotes: 1

Related Questions