...

View Full Version : passing a variable to a function



davehaz
05-30-2006, 09:54 PM
howdy,
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');
}
</script>

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.

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

davehaz
05-30-2006, 10: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?

tia.

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

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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum