Forum Moderators: open

Message Too Old, No Replies

Open New Window

         

icky_thump

2:25 pm on Mar 14, 2008 (gmt 0)

10+ Year Member



Hi all,

I don't know JS and I lost my JS guy. I have a simple (I think) adjustment to what he has already set up for me. I just cannot find the right solution.

What we set up was a page that looks like a spreadsheet; columns and rows. Click on a Column or Row Header and JavaScript generates a DIV popup bubble. In that bubble there are two links. When the links are clicked, I want them to open in a new window. Opening in the new window is the functionality I don't know how to create in JS.

The JS:
switch (index)
{
case 0:

document.getElementById('popImage').src = 'EventWeb/images/Popper_image.gif';
document.getElementById('popDescription').innerHTML = 'Text goes here';
document.getElementById('popCatalogLink').href = 'http://www.com';
document.getElementById('popPriceBookLink').href = 'http://www.com';

break;

}

The DIV model:

<div id="popbox">
<div id="poptop"></div>
<div id="adios" style="color: #00f; cursor: pointer; text-decoration: underline;" onclick="hideInfo();"></div>
<div>
<div id="popcontent">

<img id="popImage" src="EventWeb/images/Popper_image.gif" alt="InfoPlus" />
<p id="popDescription">Text goes here.</p>

<ul>
<li><a href="http://www.com" target="_blank" id="popCatalogLink">Go to catalog page</a></li>
<li><a href="http://www.com" target="_blank" id="popPriceBookLink">Go to price book page</a></li>
</ul>

</div>
</div>
<div id="popbottom"></div>
</div>

W3 has this Anchor Object model and indicated I should use:
document.getElementById('popCatalogLink').target = ‘_blank’;
but it's not working for me.

lavazza

8:16 pm on Mar 14, 2008 (gmt 0)

10+ Year Member



I want them to open in a new window

Resist the urge!

Opening a new window might make it look like the developer knows some cool tricks, but all too often it merely demonstrates a lack of understanding of and/or appreciation for accessibility issues

[w3.org...]
Web Content Accessibility Guidelines 1.0

10.1 Until user agents allow users to turn off spawned windows, do not cause pop-ups or other windows to appear and do not change the current window without informing the user. [Priority 2]
For example, in HTML, avoid using a frame whose target is a new window.
Techniques for checkpoint 10.1: [w3.org...]

icky_thump

8:42 pm on Mar 14, 2008 (gmt 0)

10+ Year Member



The original W3 answer was correct after all.

document.getElementById('popPriceBookLink').target = 'blank';

when i copied and pasted it, the quotes around blank turned into some funky quotes.