Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert Page ID via Function

Status
Not open for further replies.

ekwstats

MIS
Feb 2, 2004
70
US
I modified an Open Window function I found in the FAQs, but I can't get the ID value to pass into the function so the right page will open.

<SCRIPT LANGUAGE="JavaScript">
function MyPopUpWin(txtID) {
var iMyWidth;
var iMyHeight;

//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (320 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (412 + 50);
//Open the window.
var win2 = window.open('flyer.asp?id= + txtID','Flyer','status=no,height=825,width=640,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no');
win2.focus();
}
</SCRIPT>

This is the link that should pass the
<a href="javascript:MyPopUpWin(<%= oRS.Fields(0).Value %>)">View Flyer1</a>
When I mouseover the link the right correct ID shows up in MyPopUpWin(id).

How can I pass the oRS.Fields(0).Value to my ?ID=txtID

 
Try this:

Code:
<SCRIPT LANGUAGE="JavaScript">
function MyPopUpWin(txtID) {
var iMyWidth;
var iMyHeight;

//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (320 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (412 + 50);
//Open the window.
var win2 = window.open('flyer.asp?id=' + txtID,'Flyer','status=no,height=825,width=640,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no');
win2.focus();
}
</SCRIPT>

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Try this,
Code:
<SCRIPT LANGUAGE="JavaScript">
function MyPopUpWin(txtID) {
var iMyWidth;
var iMyHeight;

//half the screen width minus half the new window width (plus 5 pixel borders).
iMyWidth = (window.screen.width/2) - (320 + 10);
//half the screen height minus half the new window height (plus title and status bars).
iMyHeight = (window.screen.height/2) - (412 + 50);
//Open the window.
var win2 = window.open('flyer.asp?id='+ txtID+','Flyer','status=no,height=825,width=640,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no');
win2.focus();
}
</SCRIPT>

You forgot to end a quote in the varible win2. I dont know if that'll help but its worth a shot
Matt
 
Yes but I believe you may have left an extra +' in your code right after the txtID in the call to window.open.

*cLFlaVA
----------------------------
A pirate walks into a bar with a huge ship's steering wheel down his pants.
The bartender asks, "Are you aware that you have a steering wheel down your pants?"
The pirate replies, "Arrrrr! It's driving me nuts!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top