Click to See Complete Forum and Search --> : popup window


aderouin
05-08-2003, 02:44 PM
Been trying to make a link to a popup that just has a picture, but wanted it to size to the image size. Tried just making the pixel size of the page that pops up match the size of the image, but for some reason it wasn't working :(

Jona
05-08-2003, 03:04 PM
Post the code that you have.

var the_image = new Image();
the_image.src = "the_image.jpg";
window.open("the_image.jpg","the_image","width="+the_image.innerWidth+",height="+the_image.innerHeight);

khalidali63
05-08-2003, 03:46 PM
try this link.

http://68.145.35.86/skills/javascripts/OpenImageSizedWindow.html

Charles
05-08-2003, 03:56 PM
Do not follow Khalid's example. It needlessly fails one in ten times. And what's worse, Khalid knows how to do it properly. It's just a shame the way some people insist upon spreading ignorance because it's too much work to make a few small changes to their web site.

1) The proper way to open a pop-up window is as follows:

<a href="http://www.w3.org/" onclick="window.open(this.href, '', 'height=400,width=300'); return false">W3C</a>

2) The height and width that you specify are the outside height and width and you are interested in the inside height and width. And there's no set relationship between the two. Even with the same broswser running on the same platform. This might be why you are having trouble.

khalidali63
05-08-2003, 04:11 PM
wooah...hold your horses buddy.
Can you please differentiate between thses 2 lines of code

<a href="http://www.w3.org/" onclick="window.open(this.href, '', 'height=400,width=300'); return false">W3C</a>

and

<a href="http://www.w3.org/" target="_blank">W3C</a>

don't worry about target being depricated..

which line has javascript in it?

Charles
05-08-2003, 04:24 PM
The offensive piece from your page is:

<a href="javascript:Process('images/bw_01.jpg')" >Open Image WIndow</a>

Now, if you will forgive me, I must go and bathe after posting such a thing. I feel so dirty now.

khalidali63
05-08-2003, 04:32 PM
You did not answer my question Charles.
The point is you used javaScript in your code,I used the same,I am so saddened with the language you have used,and worst is that you use javascript yourself,Your preeching would have been worth something if you did not.
What can I say,you do what you think is correct,And I'll keep helping people the best I can.I can not believe that I actually thought you are a gentleman..

Charles
05-08-2003, 05:32 PM
The difference is that you rely upon JavaScript. My version of the link will still work without JavaScript. And as such it complies with the W3C's Web Content Accessibility Guidelines 1.0 priority 1 guideline 6.3Ensure that pages are usable when scripts, applets, or other programmatic objects are turned off or not supported. ... For example, ensure that links that trigger scripts work when scripts are turned off or not supported (e.g., do not use "javascript:" as the link target).
http://www.w3.org/TR/WCAG10/wai-pageauth.html#tech-scripts