By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,054 Members | 1,635 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,054 IT Pros & Developers. It's quick & easy.

Load custom window with open.window function?

P: 77
Im using the following script to resize and Automate thumbnails of user posted images on my forum. However I dont like the white background of the new window. Im wondering if its possible to launch the full size image in a customized window with a background image, such as

[HTML]Image veiwer window[/HTML]

Expand|Select|Wrap|Line Numbers
  1. <script>
  2. function ResizeThem() {
  3. maxheight=250;
  4. maxwidth= 250;
  5. imgs=document.getElementsByTagName("img");
  6. for (p=0; p<imgs.length; p++) {
  7. if (imgs[p].getAttribute("alt")=="user posted image") {
  8. w=parseInt(imgs[p].width);
  9. h=parseInt(imgs[p].height);
  10. if (parseInt(imgs[p].width)>maxwidth) {
  11. imgs[p].style.cursor="pointer";
  12. imgs[p].setAttribute('alt','Reduced Image - Click to see full size');
  13. imgs[p].onclick=new Function("iw=window.open(this.src,'ImageViewer','resizable=1,scrollbars=1');iw.focus()");
  14. imgs[p].height=(maxwidth/imgs[p].width)*imgs[p].height;
  15. imgs[p].width=maxwidth;
  16. }
  17. if (parseInt(imgs[p].height)>maxheight) {
  18. imgs[p].style.cursor="pointer";
  19. imgs[p].onclick=new
  20. Function("iw=window.open(this.src,'ImageViewer','resizable=1,scrollbars=1');iw.focus()");
  21. imgs[p].width=(maxheight/imgs[p].height)*imgs[p].width;
  22. imgs[p].height=maxheight;
  23. }
  24. }
  25. }
  26. }
  27. ResizeThem();
  28. </script>
so far I cannot find a way to make it possible. Any ideas?
Mar 12 '08 #1
Share this Question
Share on Google+
2 Replies


P: 77
Anyone? I was suggested..

two HTML pages.
One(A), which you have the thumbnails and another(B), which should pop up when you click on the thumbnail.
In page (A), create a hidden field with ID "imgurl".
And when the user clicks on a thumbnail image, store the image's URL in there before opening (B).
In page (B), create an image object and then set the src property = window.opener.document.getElementById("imgurl").va lue
I have no idea how to re-write the script to do that!! ??????
Mar 12 '08 #2

P: 77
SOLVED! No longer needed thankyou!
Mar 13 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.