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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing parameters to javascript popup

Status
Not open for further replies.

arkadia93

Programmer
Joined
Oct 19, 2006
Messages
110
Location
GB
I am trying to pass a parameter to a popup window, but without any success. Here is my code :

Dim CompanyName
CompanyName = rsLog("Name")
if ((rsLog("BrandDescription") = "PCWB") or _
(rsLog("BrandDescription") = "Equanet Education")) then
Response.Write "<td bgcolor=FFFFFF><font size=2><A HREF=""javascript:popUp('companyequanet.asp', CompanyName)"">" & rsLog("Name")& sitename & "</A></td>"
end if

And the Javascript :

function popUp(URL, CompanyName)
{
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL + "?company=" + CompanyName, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=180,height=30,left = 412,top = 284');");
}

In the status bar, I just get the string 'CompanyName' instead of the
 
Seems like to me that you'd want to pass the CompanyName variable to the browser in your response.write. As it is right now, you're sending the literal string (CompanyName) without quotes, so on the client side it thinks you're trying to pass a variable named CompanyName, when one doesn't exist. This should fix your problem:

Code:
Response.Write "<td bgcolor=FFFFFF><font size=2><A HREF=""javascript:popUp('companyequanet.asp', [!]" & [/!]CompanyName[!] & "[/!])"">" & rsLog("Name")& sitename & "</A></td>"

-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top