/    Sign up×
Community /Pin to ProfileBookmark

popping up a window, can’t get the right size…

i wrote a simple script to be imported by any of my pages that need to pop up a window to a set size. I pass the url of the image or page that I need to load, as well as the width(x) and height(y).

here’s whats in my imported javascript.js file :

function picWindow(url,x,y) {
win = window.open(url,’pwindow’,”toolbar=no,location=no,resizable=no,menubar=no,scrollbars=no,width=x,height=y”);
win.focus()
}

here’s how I import it into the html file im calling it from:

<SCRIPT language=”javascript” src=”../../javascript.js”>
</SCRIPT>

and here’s how I call it from the link that that html page:
<a href=”javascript:picWindow(‘city.jpg’,300,300)”><img src=”thumbs/city_thumb.jpg” alt=”Futuristic City”></img></a>

It pops up a new window, with the correct url, but no matter that width and height I pass it, I always get the same, too big, size.
What am I doing wrong?

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@VladdyOct 29.2004 — [i]Originally posted by susancbk [/i]

[B]<snip />

What am I doing wrong? [/B]
[/QUOTE]

Popping windows up.........:rolleyes: ?
Copy linkTweet thisAlerts:
@susancbkauthorOct 29.2004 — well this raises a good question..

is popping up windows taboo now a days?

Im creating a portfolio for a class...and this site links to projects which lead the user deep away into new sites. I figured the best way to handle this was with popups, keeping the original portfolio page intact.

I've posted a note on any page using popups letting the user know and advising them to turn off any popup blockers.

Is this a bad idea? Should I just load things in the same window?
Copy linkTweet thisAlerts:
@VladdyOct 29.2004 — "Back" button is about the first thing one learns about when entering the WWW and it works just fine when navigating the web. If visitor wants to open a link in a new window (or a new tab as most users of real browsers do) he/she have such choice.

Not only your navigation goes FUBAR when user has popup blockers (is your site THAT important for one to change their settings) or has JS disabled, you deny your visitors a choice of how they want to navigate a site. Hardly a good idea....
Copy linkTweet thisAlerts:
@Warren86Oct 29.2004 — Try the x and y this way, and it must be an unbroken string, without a CRLF.

function picWindow(url,x,y) {

win = window.open(url,'pwindow'," toolbar=no,location=no,resizable=no,menubar=no,scrollbars=no,width="+x+",height="+y+"");

win.focus()

}
Copy linkTweet thisAlerts:
@CharlesOct 29.2004 — susancbk, a couple of things...

  • * The "type" attribute is required with the SCRIPT element.


  • [font=monospace]<SCRIPT type="text/javascript" src="../../javascript.js"></SCRIPT>[/font]

  • * If you set the size of a new window, then all of the other stuff defaults to "no".


  • [font=monospace]function picWindow(url,x,y) {

    win = window.open(url, 'pwindow', 'width=' + x + ',height=' + y);

    win.focus();

    return false;

    }[/font]

  • * If you must use a pop up at least do so in a way that the page works for those of us who eschew JavaScript.


  • [font=monospace]<a href="city.jpg" onclick="return picWindow (this.href, 300, 300)"><img src="thumbs/city_thumb.jpg" alt="Futuristic City"></a>[/font]
    ×

    Success!

    Help @susancbk spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...