Log in

No account? Create an account

Dustin LindenSmith

father | musician | writer

Previous Entry Share Next Entry

a cry for javascript help

Okay, I've looked on a number of javascript sites and even tried some little script generators, but I can't figure this simple thing out. I'm not experienced with this at all, so if anyone has the answer, please start from the beginning.

All I want to do is stick some javascript into a text link that opens a webpage in a new window that's a specific size and position on the screen. Shouldn't that be simple? I've seen it before, but I can't track down that example anymore. I know that I can use the target tag in plain HTML to open a link in another window, but what javascript do I include with the link to make it open in another window that's a certain size and position on the screen?

For argument's sake, here are my parameters:

Link text: Click here
URL: http://www.livejournal.com
new window width: 300 pixels
new window height: 400 px
position left: 40 px
position top: 20 px

If anyone knows how to do this properly or can refer me to a site that doesn't speak purely tech-ese, I'll buy you a beer the next time I see you.

By the way, what HTML tag do you use when you want to print script on an HTML page without the browser interpreting it as HTML (i.e. to provide the answer to my question)?

  • 1
firinel January 19th, 2002
its a really simple thing, and if some kind soul doesn't offer you the answer, I'll give it to you sometimes, but nto right now.

I've used it and forgotten it again :/ I'll dig around thru my old code and find it for you. I'll try to find it asap.

iamom January 19th, 2002
Thanks, baby. I found something that I thought would work, but then it didn't...

If you want to use javascript on a page, do you have to put something about it in the header of that page first? I feel like that's something I haven't done yet...

firinel January 19th, 2002
my fridge faerie page uses the javascript like you were mentioning. Here's an example of the code:

<a href="javascript: var win=window.open('poems/winterblackness.html','popup','toolbar=0,status=0,directories=0,scrollbars=1, resizable=0,menubar=0,location=0,width=530,height=410'); win.focus();">bleakness</a>

So what this would do is, when the link 'bleakness' is clicked in it will open a different window, that is 530x410, with the file

When you do it just replace the size to what size you want it - that's fairly self explinaitory; where 'bleakness' is, replace it with what you'd like the link to say, and where poems/winterblackness.html is, replace with your file name.

You don't need to put anything in the heading for it to work.


iamom January 22nd, 2002
Thank you, thank you, thank you, thank you, thank you, thank you, thank you, thank you.

Your script works perfectly, and I've used it about ten times since you gave it to me. (That's why I haven't had time to reply until now!)

Thanks again, it was a huge help.


firinel January 22nd, 2002
you're more than welcome.

chaizzilla January 19th, 2002
btw bless you for not having parameters than make a window that's bigger than and/or ends up partly off the page of most people's monitors.. this happens to me so often at 800x600 that it even suprised me to find my dislike of web designers could actually get worse rather than better within months of upgrading my stystem, they're outpacing me.

iamom January 22nd, 2002
Interesting. So, are you using a 15" monitor, then? Is that why you're only set at 8 by 6?

chaizzilla January 22nd, 2002
i dont have a ruler handy but it's not a huge monitor, no. anything over 800x600 and i have to drop to 256 colours or deal with low-htz flicker. i just find web desigers that never bother to consider less than the latest eqiupment annoying. i've only been at 800x600 for about a year or so, before then i was at 640x480 and man did web designers irritate me then


iamom January 22nd, 2002
I have a 17" monitor, but I know someone with a 19", which looks like a TV set to me. When you put the resolution up high to 1600x1280 all the apps and fonts become too small to read, anyway.

I've heard that Windows XP addresses this problem with a larger interface that scales up or down according to the resolution of your monitor. However, I doubt if that feature alone makes it worth the extremely high price for it.

Just rambling.

chaizzilla January 22nd, 2002
careful w/that rambling, i think it's still 3 months in the stockade for that in some quarters..

  • 1