Window.Open () not working

J

JNariss

Hello,

Within a form I created I have placed links that users can click on to
view information. I am trying to write a javascript code so it opens in
a sized window but I can't seem to figure this out. So far I have come
up with the following:

<script language="JavaScript" type="text/javascript">
var WindowObjectReference; // global variable

function openRequestedPopup()
{
WindowObjectReference =
window.open("http://egsrosintra1/egs intranet/ACPCodes.html",
"ACP Codes",
"width=420,height=230,resizable,scrollbars=yes,status=1");
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>BPCS and Logpro User Authority Form</title>
<style type="text/css">


And in the text code: <p><a
href="javascript:OpenRequestedPopup('http://egsrosintra1/egs intranet/ACPCodes.html');">ACP
- Accounts Payable</a><br />


Any ideas as to why it is not working correctly? And when I need to add
the additional criteria to open the other links where would I insert
that code?

Thanks in advanced,
Justine
 
G

GRenard

Look at your function... case sensitive + argument list is completly
not the same...
 
J

JNariss

I still can't seem to get it to work. I looked at the function and
noticed in my href= that the "O" should have not been capitalized. Then
I changed the rest to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<<<-------------SCRIPT STARTS HERE-------------------------->>>>


<script language="JavaScript" type="text/javascript">
var WindowObjectReference; // global variable
function openRequestedPopup()
{
WindowObjectReference = window.open("", "", "width=420,height=230");
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>BPCS and Logpro User Authority Form</title>
<style type="text/css">
<!--
..style1 {
color: #666666;
font-style: italic;
}
..style3 {
font-size: 18px;
color: #000066;
}
#Layer1 {
position:absolute;
left:570px;
top:491px;
width:262px;
height:322px;
z-index:1;
}
..style8 {font-size: 18px; color: #FF0000; }
-->
</style>
</head>

<body>
<div id="Layer1" style="position: absolute; left: 540px; top: 476px;
width:235px">
<p align="center"><u><font color="#808080" size="4"><b>Transaction
Codes:</b></font></u></p>

<<<<-----------------------------------ANCHOR HREF TAG IS
BELOW-------------------->>>>:


<p><a
href="javascript:eek:penRequestedPopup("http://egsrosintra1/egs intranet/ACPCodes.html",
"ACP Codes");">ACP - Accounts Payable</a><br />
<a href="ACRCodes.html" target="_blank">ACR - Accounts
Receiveable</a><br />
<a href="BILCodes.html" target="_blank">BIL - Billing</a><br />
<a href="BOMCodes.html" target="_blank">BOM - Bill of Material</a><br
/>
<a href="CAPCodes.html" target="_blank">CAP - Capacity
Planning</a><br />
<a href="CSTCodes.html" target="_blank">CST - Cost</a><br />
<a href="DRPCodes.html" target="_blank">DRP - Distribution Resource
Planning</a><br />
<a href="FORCodes.html" target="_blank">FOR - Forecasting</a><br />
<a href="INVCodes.html" target="_blank">INV - Inventory
Management</a><br />
<a href="JITCodes.html" target="_blank">JIT - Just in Time /
Repetitive Mgmt.</a><br />
MDM - Manufacturing Data
</p>
</div>
<h1 align="center" class="style1">BPCS and LogPro User Authority
Form</h1>
<form action="SecurityReqThanks.asp" method="post"
name="SecurityRequest" target="_blank" id="SecurityRequest">
<p class="style3">User Information -All fields are required: </p>
<p>
<label>First Name:
<input name="UserFirstName" type="text" id="UserFirstName"
size="25" maxlength="15" />
</label>
<label>Last Name:
<input name="UserLastName" type="text" id="UserLastName" size="22"
maxlength="30" />
</label>
<br />
<label>ID Number:
<input name="UserID" type="text" id="UserID" size="24"
maxlength="10" />
</label>
<label>Site:
<select name="UserSite" id="UserSite">
<option value="Select" selected="selected">Select</option>
<option value="Amiens, France">Amiens, France</option>
<option value="Atizapan, Mexico">Atizapan, Mexico</option>
<option value="Celina, Tennessee">Celina, Tennessee</option>
<option value="Columbus, Nebraska">Columbus, Nebraska</option>
<option value="East Granby, Connecticut">East Granby,
Connecticut</option>
<option value="Elmira, Canada">Elmira, Canada</option>
<option value="Fullerton, California">Fullerton,
California</option>
</select>
</label>
<br />
<label>Data Base:
<select name="DataBase" id="DataBase">
<option value="Select" selected="selected">Select</option>
<option value="ECM / Sola / Heat">ECM / Sola / Heat</option>
<option value="EZ Heat Canada">EZ Heat Canada</option>
<option value="EZ Heat U.S.">EZ Heat U.S.</option>
</select>
</label>
</p>
<p>
<label><span class="style3">Copy Authority Information:</span><br
/>
First Name:
<input name="CopyFirstName" type="text" id="CopyFirstName"
maxlength="15" />
Last Name:
<input name="CopyLastName" type="text" id="CopyLastName"
maxlength="30" />
<br />
ID Number:
<input name="CopyAuthID" type="text" id="CopyAuthID" size="23"
maxlength="10" />
</label>
</p>
<p class="style3">Authority Exceptions</p>
<ol>
<li><a href="#TransactionCodes">Transaction Codes</li></a>
<li><a href="#WarehouseCodes">Warehouse Codes</li></a>
<li><a href="#TransactionEffectCodes">Transaction Effect
Codes</li></a>
<li><a href="#LogProDeptAuthority">LogPro Department Authority
</li></a>
<li><a href="#UserMenu">User Menus</li></a>
</ol>

<p class="style8"><u>Please separate each code to be
&quot;removed&quot; or &quot;added&quot; with a comma:</u></p>
<label> <span class="style3"><a id="TransactionCodes"
name="TransactionCodes">1. Transaction Codes </a></span><br />
<br />
Remove:<br />
<textarea name="TransactionRemove" cols="60" rows="5"
id="TransactionRemove"></textarea>
</label>
<p>
<label>Add: <br />
<textarea name="TransactionAdd" cols="60" rows="5"
id="TransactionAdd"></textarea>
</label>
</p>
<p class="style3"><a id="WarehouseCodes" name="WarehouseCodes">2.
Warehouse Codes</a> </p>
<p>
<label>Remove: <br />
<textarea name="WarehouseRemove" cols="60" rows="2"
id="WarehouseRemove"></textarea>
</label>
</p>
<p>
<label>Add: <br />
<textarea name="WarehouseAdd" cols="60" rows="2"
id="WarehouseAdd"></textarea>
</label>
</p>
<p class="style3"><a id="TransactionEffectCodes"
name="TransactionEffectCodes">3. Transaction Effect Codes (for INV500
and PUR550)</a></p>
<p>
<label>Remove:<br />
<textarea name="TransactionEffectRemove" cols="60" rows="2"
id="TransactionEffectRemove"></textarea>
</label>
</p>
<p>
<label>Add:<br />
<textarea name="TransactionEffectAdd" cols="60" rows="2"
id="TransactionEffectAdd"></textarea>
</label>
</p>
<p class="style3"><a id="LogProDeptAuthority"
name="LogProDeptAuthority">4. LogPro Department Authority</a></p>
<p>
<label>Remove:<br />
<textarea name="LogProRemove" cols="60" rows="2"
id="LogProRemove"></textarea>
</label>
</p>
<p>
<label>Add:<br />
<textarea name="LogProAdd" cols="60" rows="2"
id="LogProAdd"></textarea>
</label>
</p>
<p class="style3"><a id="UserMenu" name="UserMenu">5. User
Menus</a></p>
<p>
<label>Remove:<br />
<textarea name="UserMenuRemove" cols="60" rows="2"
id="UserMenuRemove"></textarea>
</label>
</p>
<p>
<label>Add:<br />
<textarea name="UserMenuAdd" cols="60" rows="2"
id="UserMenuAdd"></textarea>
</label>
</p>
<p>
<label><span class="style3">Comments:</span><br />
<textarea name="Comments" cols="60" rows="5"
id="Comments"></textarea>
</label>
</p>
<p>
<label>Authorized Submitter:
<input name="AuthorizedSubmitter" type="text"
id="AuthorizedSubmitter" size="40" maxlength="40" />
</label>
<input name="SecurityDate" type="hidden" id="SecurityDate" />
04/04/2006</p>
<p>
<input type="submit" name="Submit" value="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="reset" name="Submit2" value="Reset" />
</p>
<p>&nbsp;</p>
</form>
</body>
</html>


Any help or refereneces are appreciated

Thanks once again,
Justine
 
G

GRenard

NEVER post entirely code like that... it is SO useless

I said check your arguments :

function openRequestedPopup() <---- no argument here
and
javascript:eek:penRequestedPopup("http://egsrosintra1/egs intranet/ACPCodes.html",
"ACP Codes"); <---- arguments here

change your function add 2 arguments: a1, a2, and do something like
that
WindowObjectReference = window.open(a1, a2, "width=420,height=230");

The a2 is a title of the page and i don't think spaces are allowed
 
R

Randy Webb

GRenard said the following on 4/6/2006 3:58 PM:

Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at
the top of the article, then click on the "Reply" at the bottom of the
article headers. said:
NEVER post entirely code like that... it is SO useless

I said check your arguments :

function openRequestedPopup() <---- no argument here
and
javascript:eek:penRequestedPopup("http://egsrosintra1/egs intranet/ACPCodes.html",
"ACP Codes"); <---- arguments here

The original code had javascript:OpenRequestedPopup with a capital O,
the function name had a lowercase o.
change your function add 2 arguments: a1, a2, and do something like
that
WindowObjectReference = window.open(a1, a2, "width=420,height=230");

The a2 is a title of the page and i don't think spaces are allowed

They aren't in IE.
 
G

Gérard Talbot

Hello,

Within a form I created I have placed links that users can click on to
view information. I am trying to write a javascript code so it opens in
a sized window but I can't seem to figure this out. So far I have come
up with the following:

<script language="JavaScript" type="text/javascript">

Language is deprecated; just use type. Idem est:

<script type="text/javascript">

http://www.w3.org/TR/html401/interact/scripts.html#adef-language
var WindowObjectReference; // global variable

function openRequestedPopup()
{
WindowObjectReference =
window.open("http://egsrosintra1/egs intranet/ACPCodes.html",
"ACP Codes",


"strWindowName
This is the string that just names the new window. Such string can
be used to be the target of links and forms when the target attribute of
an <a> element or of a <form> is specified. This [Window name] string
parameter *_should not contain any blank space_*."
http://developer.mozilla.org/en/docs/DOM:window.open#Return_value_and_parameters

Idem est:
"ACPCodes" or "ACP_Codes"
"width=420,height=230,resizable,scrollbars=yes,status=1");

It's better to define the function like this:

<script type="text/javascript">
var WindowObjectReference;
function openRequestedPopup(strUrl, strWindowName)
{
if(!WindowObjectReference || WindowObjectReference.closed)
{
WindowObjectReference =
window.open(strUrl, strWindowName,
"width=420,height=230,location,resizable,scrollbars,status");
}
else
{
WindowObjectReference.focus();
};
}
</script>

(...)

and then to structure the call like this:

<p><a href="http://egsrosintra1/egs intranet/ACPCodes.html"
target="ACPCodes"
onclick="openRequestedPopup(this.href, this.target); return false;"
title="Clicking this link will create a new window or will bring up back
on top an already opened secondary window">Show the ACP -- Accounts
Payable</a></p>

In the openRequestedWindow, I added location because its presence will
be forced in IE 7.

The above code could be furthermore improved if we knew for what this
would be used.
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>BPCS and Logpro User Authority Form</title>
<style type="text/css">


And in the text code: <p><a
href="javascript:OpenRequestedPopup('http://egsrosintra1/egs intranet/ACPCodes.html');">ACP
- Accounts Payable</a><br />

Never use "javascript:" pseudo-protocol, even if your webpage was to go
on an intranet. "javascript:" pseudo-protocol will break in many
situations and contexts, even on an intranet. An href attribute value
should *_always_* have a real link.

http://developer.mozilla.org/en/doc...D.22javascript:window.open.28....29.22_....3E

http://www.panix.com/~aahz/javascript.html#remove

http://jibbering.com/faq/#FAQ4_24

Gérard
 

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

Members online

Forum statistics

Threads
473,982
Messages
2,570,189
Members
46,734
Latest member
manin

Latest Threads

Top