Simple javascript Q

Posted on 2006-03-28
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)


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%> - <>" 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;-

many thanks
Question by:claracruz
    LVL 22

    Accepted Solution

    Hi claracruz,

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

    check with


    LVL 9

    Expert Comment

    in javascript we dont use <%=
    try this

    <script language="javascript">
    function openZoom(which, pid)

    LVL 28

    Expert Comment

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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
    I will show you how to create a ASP.NET Captcha control without using any HTTP HANDELRS or what so ever. you can easily plug it into your web pages. For Example a = 2 + 3 (where 2 and 3 are 2 random numbers) Session("Answer") = 5 then we…
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
    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:

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now