O'Reilly logo

eBay Hacks, 2nd Edition by David A. Karp

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Hack #78. Customize Pop-up Image Windows

Have your thumbnails open slick, customizable pop-up windows.

There are times when it pays to have a compulsive personality, which you probably like to call "attention to detail."

On eBay, for instance, "attention to detail" makes your listings look more professional and will likely compel you to more carefully describe and photograph your items, both of which are good ways to inspire trust with your bidders [Hack #8] and set a proper expectation [Hack #50] . But why stop there?

If you're including clickable thumbnails [Hack #77] or video clips [Hack #58] in your listings, you can customize the pop-up windows that appear using JavaScript.

Unfortunately, this is not as easy as it sounds. On most other web sites, you could do this quite simply with the window.open JavaScript statement, but as described in the Preface, eBay displays the "Your listing cannot contain JavaScript" error if you try to submit a description containing the window.open statement in any context.

The Code

Instead, a slightly more complex script is needed. Start by placing the following JavaScript code in the beginning of your listing description:

<script language="JavaScript"> 
     var w = window;
     var whack = w.open;
     function ohack(url, name, attributes) { return (new Object()); } 
     w.open = ohack;

     var objImage = new Image();

     function showpic(url) {

    objImage.src = url;
   width ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required