Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Simple javascript Q

Posted on 2006-03-28
3
Medium Priority
?
267 Views
Last Modified: 2013-11-19
Hello experts,


I have a small problem.. I have a form that calls the following function;-

<script language="javascript">
function openZoom(which, pid)
{
      var newWindow=window.open("zoommattress.asp?prod=<%=pid%>","","width=675,height=475,resizable=0,status=yes,scrollbars=yes,screenX=100,screenY=100,top=100,left=100'");
      
}


</script>

This is where I call the function
<div class="imagebox"><a href="javascript:openZoom(2, <%=Product.product_id%>);"><img src="images/medium/<%=Product.image_medium%>" alt="<%=MyCategory.cat_name%> - <%=Product.name%>" width="140" border="0"class="border"/></a></div>


I know that 'Product.product_id' has a value cos when I do an alert(pid) it displays the correct product_id

But for some reason there is no value for pid on this line;-
var newWindow=window.open("zoommattress.asp?prod=<%=pid%>"

many thanks
0
Comment
Question by:claracruz
3 Comments
 
LVL 22

Accepted Solution

by:
Ivo Stoykov earned 2000 total points
ID: 16309617
Hi claracruz,
instead
> newWindow=window.open("zoommattress.asp?prod=<%=pid%>",...
use
window.open("zoommattress.asp?prod="+pid+",...

what you try to do is to use server side var on client side script - this cannot be done this way...

check with
alert(pid);

HTH

I
0
 
LVL 9

Expert Comment

by:Lakio
ID: 16309629
in javascript we dont use <%=
try this

<script language="javascript">
function openZoom(which, pid)
{
     var newWindow=window.open("zoommattress.asp?prod="+pid,"","width=675,height=475,resizable=0,status=yes,scrollbars=yes,screenX=100,screenY=100,top=100,left=100'");
     
}


</script>
0
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 16310537
What is the purpose of passing which ???

0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question