Size of a new opened window

S

somemelvin1

I'm using Pub 2003 and IE7. I'm having trouble re-sizing a new window. The
new window opens but without following the parameters in the Open.Window
command.

Can someone tell me if something looks wrong with the syntax of the
following statement:

<a href=..\cobycomhome_files\personalization.htm target="monogram_window"
onclick="window.open(..\cobycomhome_files\personalization.htm,
'monogram_window', 'title=no,location=no,menubar=no,toolbar=no,scrollbars=no,
height=761, width=615');return false;"
onkeypress="window.open(..\cobycomhome_files\personalization.htm,
'monogram_window', 'title=no,location=no,menubar=no,toolbar=no,scrollbars=no,
height=761, width=615');return false">

Thanks
 
D

DavidF

I am not very strong when it comes to writing code, but shouldn't you be
using forward slashes? Beyond that I don't know enough to troubleshoot.
Perhaps Reference:
http://office.microsoft.com/en-us/publisher/HA011587451033.aspx

This article describes two ways of opening new windows and explains the
code. Perhaps it will give you an idea of what you are doing wrong.

I have found the ECMAScript code approach is more versatile, but there is an
error in the code. Under item 2, instead of the following:

<script language="JavaScrip­t" type="text/javascri­pt"> <!-- function
Show(Url, Name, Features)
{ window.open(Url, Name, Features); } // --> </script>

use this snippet instead:

<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url, Name, Features); }</script>

DavidF
 
E

Eric James

There appear to be at least two things wrong with it - the url's should all
be within quotes, and the backslashes will probably only work in internet
explorer, and should be forward slashes for compatibility with other
browsers, viz:

<a href="../cobycomhome_files/personalization.htm" target="monogram_window"
onclick="window.open('../cobycomhome_files/personalization.htm',
'monogram_window',
'title=no,location=no,menubar=no,toolbar=no,scrollbars=no,height=761,
width=615'); return false;"
onkeypress="window.open('../cobycomhome_files/personalization.htm',
'monogram_window',
'title=no,location=no,menubar=no,toolbar=no,scrollbars=no, height=761,
width=615'); return false;">

whether the url is correct or not obviously depends upon the context.
The 'onkeypress' action probably isn't to be recommended - it will give
unpredictable results as it will only work when the link has focus.

DavidF is incorrect in his statement concerning the code sample he
referenced - it is in fact correct and the comment tags are there for a good
reason, which is to prevent browsers which do not support javascript from
displaying the code, although they may be rarely used these days.
 
M

MAURH

Hi Somemelvin1,

I use the ECMAScript code that DavidF suggests, I find it easy to use and it
works every time for me. You can copy and paste it from here, then go to
Insert>HTML Code Fragment and insert the script.

<script language="JavaScript" type="text/javascript">function Show(Url,
Name, Features) { window.open(Url, Name, Features); }</script>

When you've clicked OK, a box will appear on your website page. Place this
box anywhere on your page that won't overlap any other feature....and you
can make it as small as you like. You only need to do it once on that page
and it will not show when you publish.

Type the name you want to hyperlink on your page, highlight it and go to
'Insert Hyperlink' and in this box you insert this code into the address
field:

JavaScript:Show('http://*****/','newwindow','')

again you can copy and paste it from here. Delete the stars ***** and
replace with the website address you wish to link to. Click OK and when you
do a preview and click on the link, it should open in a new window. I
usually save this code in notepad so it's easy to change the URL each time
and then copy and paste into the address field.

If you want to change the size of the window, delete the ") after 'new
window' and add

'toolbar=no,scrollbars=yes,resizable=yes,height=250,width=250')

This will give you a window that doesn't have a toolbar, but does have a
scroll bar and is resizable, which at the moment is 250 x 250. in dimension.
If you want to adapt the size just change the dimensions.

Maureen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top