Forum Moderators: open
Creating an exit pop-up requires that you deal with a few issues. You need to know that your visitor is actually leaving your site, and not just going to another page on your site.
There are many approaches to this, which involve either javascript or server-side scripting (PHP and the like), but there's no way to handle these needs using just HTML. In fact, even cookies are not an HTML issue.
So, as a first step, I'd suggest you do a Google search on WebmasterWorld [google.com] for "exit pop-up site:webmasterworld.com" and you'll find lots of ideas from past posts here. Then, bring any questions you have to our Javascript Forum [webmasterworld.com] or to any of the server-side forums for the technology you intend to use. Good luck with it.
To get you started, here's one thread about creating exit pop-ups in a relatively simple way. But it doesn't address not showing it on every visit, just when people are leaving your site.
How to create a pop up at exit of site & not page? [webmasterworld.com]