Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

opening pictures with window.open()

Status
Not open for further replies.

airswit

Programmer
Apr 19, 2003
23
US
hey, i am doing some thumbnail pictures, where when you click on them, they open in a new window, with correct size and all that. now, i want there to be no border on the page. do i have to make a separate html file, then have the url for that, with no border?! this is the javascript i have in the func now:

window.open("pic.jpg",'',[options]);
 
did you upload the openwind.js file, and have it in the same dir as the html file? you can just try this out on ur comp by putting all these files on ur desktop, or all in the same folder anywhere, then open up the html file in browser. then you don't have to upload it every time.


aw, sh*t, change it to:
Code:
<script type="javascript" [b]src[/b]="openwind.js"></script>

my bad, didn't look at the code when i wrote that. hope it gets workin for ya
 
Thanks airswit, I like your way of censoring your keywords!

Anyway, still not getting there, and about to give up I think:
Got this in an openwind.js file
Code:
function openwind(l, x, y) {
    var width = x || 800;
    var height = y || 600;
    var options = 'width=' + width + ',height=' + height;
    var wind = window.open('', '', options);
    wind.moveTo( (screen.width/2-width/2), (screen.height/2-height/2) );
    wind.document.open();
    wind.document.write('<html><body style="border:0px;margin:0px;"><img src="' + l + '"></body></html>');
    wind.document.close();
}
Got this in betwen the <head></head> tags of my testpage.htm file:
Code:
<script type="javascript" src="openwind.js"></script>
Got this in the main body of the html file:
Code:
<a href="javascript:void(0);" onclick="openwind('images\sunset2.gif',700,400); return false;"><img src="images\sunset2.gif" width="255" height="161"></a>
Guess what? Still cant get it to go. Anyone here want an application written in Visual FoxPro?
Just as well my enquiry on this thread is for my own website otherwise I'd never make any money!

What do you think guys and what am I clearly missing here? (Except for brain cells)
Lee.....

VisFox Version 6 User / Windows ME
 

Change the backslash in your image paths to a forwardslash. Paths in HTML and JS should always use forwardslashes (as per your original post - why did you change them around?)

Hope this helps,
Dan
 
Hi Dan

I have no idea how that happened

Post back soon
Lee

VisFox Version 6 User / Windows ME
 
Made the changes and still not working

Lee....

VisFox Version 6 User / Windows ME
 
What is it not doing? Just not opening a new window? What browser are you trying it in? If IE, do you get a yellow triangle (JS error) in the status bar? If so, can you double-click it and see what the error says? Can you run the code in, say, Firefox instead of IE and see if it works? Can you turn on the JS console and see if any errors appear?

Failing all of that, can you post the current code that you are now using, or even better, upload the code to a page and post the URL?

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top