# Simple HTML Question

**URL:** https://boards.straightdope.com/t/simple-html-question/366297
**Category:** Factual Questions
**Created:** [July 27, 2006, 5:49pm UTC](https://boards.straightdope.com/t/simple-html-question/366297 "2006-07-27T17:49:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![enipla](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@enipla](https://boards.straightdope.com/u/enipla)
#### Post date: [July 27, 2006, 5:49pm UTC](https://boards.straightdope.com/t/simple-html-question/366297/1 "2006-07-27T17:49:04Z")

</div>

OK this is driving me nuts.

I just want to open a new window with the target=\_blank in attribute of the anchor tag. No problem. Thing is, I can’t get the window to be a specific height and width.

I’ve tried -

\<A TARGET=\_BLANK height=10 href=test.htm\>test htm\</A\>

and

\<A TARGET=\_BLANK style=height:10 href=test.htm\>test htm\</A\>

Neither opens up the window at the smaller size.

I’m seeing zebras, what’s up?

---

<div class="post-metadata">

### Author: ![simster](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/simster/32/1047_2.png) [@simster](https://boards.straightdope.com/u/simster)
#### Post date: [July 27, 2006, 5:57pm UTC](https://boards.straightdope.com/t/simple-html-question/366297/2 "2006-07-27T17:57:46Z")

</div>

If you want to open up a window with specific attributes (height, width, etc) you’ll have to use JS to do it.

function openWindow(url)  
{  
wheight=“200”;  
wwidth=“410”;  
wleft=“200”;  
wtop=“200”;  
opts=‘width=’ + wwidth + ‘,height=’+wheight+ ‘,status=yes,resizable=1,left=’ + wleft + ‘,top=’+wtop;  
newWindow=window.open(url,‘windowname’,opts);

}

TTBOMK, you cannot set options on the ‘default’ target(s) (\_blank, \_new, etc).

---

<div class="post-metadata">

### Author: ![simster](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/simster/32/1047_2.png) [@simster](https://boards.straightdope.com/u/simster)
#### Post date: [July 27, 2006, 5:59pm UTC](https://boards.straightdope.com/t/simple-html-question/366297/3 "2006-07-27T17:59:01Z")

</div>

secondly, in your \<a…\> tag above, the style you’ve put in only refers to the element itself, not the window you’re trying to open.

---

<div class="post-metadata">

### Author: ![CookingWithGas](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/cookingwithgas/32/485_2.png) [@CookingWithGas](https://boards.straightdope.com/u/CookingWithGas)
#### Post date: [July 27, 2006, 5:59pm UTC](https://boards.straightdope.com/t/simple-html-question/366297/4 "2006-07-27T17:59:43Z")

</div>

You can’t do it just HTML, but you can with JavaScript. [This site](http://www.hooverwebdesign.com/templates/new-window-generator.html) holds your hand and actually generates the code for you to insert in your HTML.

---

<div class="post-metadata">

### Author: ![enipla](https://avatars.discourse-cdn.com/v4/letter/e/54ee81/32.png) [@enipla](https://boards.straightdope.com/u/enipla)
#### Post date: [July 27, 2006, 6:05pm UTC](https://boards.straightdope.com/t/simple-html-question/366297/5 "2006-07-27T18:05:26Z")

</div>

> [@CookingWithGas](#):
>
> You can’t do it just HTML, but you can with JavaScript. [This site](http://www.hooverwebdesign.com/templates/new-window-generator.html) holds your hand and actually generates the code for you to insert in your HTML.

Cool, thanks. I was sure I had lust done it with HTML before.

---

<div class="post-metadata">

### Author: ![Beadalin](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@Beadalin](https://boards.straightdope.com/u/Beadalin)
#### Post date: [July 27, 2006, 6:38pm UTC](https://boards.straightdope.com/t/simple-html-question/366297/6 "2006-07-27T18:38:46Z")

</div>

Here’s script you can embed within the link itself:  
\<a href="#" onClick=“CmgPopUp=window.open(‘yourpage.htm’,‘CmgPopUp’,‘toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes,width=400,height=300’); return false;”\>
