Hello
Can you pass an object to a javascript function. For example I have a calendar example that I want to make more user friendly. The original coding is here
function ShowDate()
{
var cSearchValue=sh owModalDialog(" Calendar.asp",0 ,"dialogwidth=2 98px;dialogheig ht=280px");
if (cSearchValue != -1 && cSearchValue != null && cSearchValue != "")
{
document.all.tx tDueDate.value = cSearchValue;
document.all.tx tDate.value = cSearchValue;
}
}
What I would like to do is pass objects into this function like
function ShowDate(obj)
and get it to populate the object automatically without having to reference each individual text box from within the function.
Here is the call to the functon currently
<td><INPUT type="text" name="txtDate" value="<%=strDu eDate%>" disabled>
<A OnClick=ShowDat e()><IMG align=top border=0 height=17 id=dimg1 src="../images/calendar.GIF" width=18></A>
<input type="hidden" name="txtDueDat e" size="20" value="<%=strDu eDate%>" >
</td>
In this version I disable the original texbox to stop users messing with date formats and use the hidden value for updates etc
This version is ok if there is only need for one date picker, but I have a need for a page that will need several different dates...
Please be kind I am a newbie :-)
Can you pass an object to a javascript function. For example I have a calendar example that I want to make more user friendly. The original coding is here
function ShowDate()
{
var cSearchValue=sh owModalDialog(" Calendar.asp",0 ,"dialogwidth=2 98px;dialogheig ht=280px");
if (cSearchValue != -1 && cSearchValue != null && cSearchValue != "")
{
document.all.tx tDueDate.value = cSearchValue;
document.all.tx tDate.value = cSearchValue;
}
}
What I would like to do is pass objects into this function like
function ShowDate(obj)
and get it to populate the object automatically without having to reference each individual text box from within the function.
Here is the call to the functon currently
<td><INPUT type="text" name="txtDate" value="<%=strDu eDate%>" disabled>
<A OnClick=ShowDat e()><IMG align=top border=0 height=17 id=dimg1 src="../images/calendar.GIF" width=18></A>
<input type="hidden" name="txtDueDat e" size="20" value="<%=strDu eDate%>" >
</td>
In this version I disable the original texbox to stop users messing with date formats and use the hidden value for updates etc
This version is ok if there is only need for one date picker, but I have a need for a page that will need several different dates...
Please be kind I am a newbie :-)
Comment