Popup window advice needed

Hi,

I’m in the process of updating/unobtrusifying my gallery website.

The html for the thumbnail links is generated in PHP from a database.

In javascript I want to disable the thumbnail links’ default behaviour and instead open up the hi-res image along with relevant details in a PHP pop-up window.

I need to pass an identifier to popup.php and wondered if it was ‘a okay’ to add a ‘picId’ property to my html as follows and then construct a URL something along the lines of ‘popup.php?imageId=’ + imgLink[x].getAttribute(‘picId’).

<li>
  <a href="ASSETS/Hires/Torosaurus.jpg" [B]picId="1"[/B]>
    <img src="ASSETS/Thumbs/Torosaurus.jpg" alt="Torosaurus"
    <span>Torosaurus</span>
  </a>
</li>

Is the above idea a bad idea semantically or just a bad idea fullstop.

Thanks

RLM

Hi,

I don’t think classes and id’s are meant to start with numbers - could be for supporting older browsers, or they may not be styled correctly with CSS selectors.

HTML5 has introduced the idea of data attributes which could also be used when you need more than the id / class allow.
John Resig - HTML 5 data- Attributes

Basically it’s ok to add any attribute for attaching extra data to an element by prefixing with ‘data-’

<a href="ASSETS/Hires/Torosaurus.jpg" data-id="1">

That’s spot on Mark. Thanks a lot:)