View Full Version : passing a variable to a function

05-30-2006, 10:54 PM
I have written a little script that I need to pass a variable to can this be done, if so how? below is the script and the way I am calling it thanks.
btw, this is the first actual js script I have ever written if it is messy please forgive.

<script language="javascript">
function sendto()
window.open('<? echo "../merchants/".$sento; ?>','newwin' ,'toolbar,scrollbars,resizable, width=640 , height=480');

Here is how I am calling it.

echo "<tr><td><a href='$url' onClick='sendto()'>$value</a>-$max $z available</td></tr>";

I am in fact trying to send a php variable by using echo, I have done this successfully in other js scripts that I have used.

05-30-2006, 11:07 PM
look at the rendered HTML to see whats wrong

05-30-2006, 11:29 PM
this is working ok, but it wont find the file that $sento is supposed to be. I can enter a static address http://www.yahoo.com and it goes right to it. So I dont think $sento is being passed to it? any ideas?


05-31-2006, 07:08 PM
post the rendered HTML

05-31-2006, 07:59 PM
thanks, but I figured it out this morning. Working great, no problem with the php as mentioned earlier.