i am trying to pass parameter value from one javascript function to another.
From Below Code: i am passing two values from function formatLink to function openDialog .But only the first value(cellvalue) is passing correctly but the send value (para) is not passing .
Why i it is not passing to function openDialog?
Please help me
<script type="text/javascript">
function formatLink(cellvalue, options, rowObject)
{
var para=image.jpg;
return "<a style='cursor:pointer;' onClick='javascript:openDialog("+cellvalue+"),("+para+")'><img width='63' height='25' src='<s:url action='ImageAction' namespace='/myimage/secure'></s:url>" + "?imageId="+para+ "'></a>";
}
function openDialog(cellvalue,para) {
alert(para);//this is coming as undefine
alert(cellvalue);//& this values is coming correctly
//below diaologbox id is given to open
$("#employees_details").load("<s:property value="loadformurl"/>?themeid="+employee);
$("#employees_details").dialog('open');
}
You have some extra parentheses in your generated function call:
change
to
Notice, I removed the ending and beginning parentheses in the onClick handler and fixed some quotes:
UPDATE
Answer is best shown in this fiddle: http://jsfiddle.net/sHQEn/