D
David C
I have an aspx page with Javascript inside a script block at the end of my
aspx page. I am trying to show or hide 2 tables inside a FormView but I keep
getting the value in Javascript as "undefined" and I cannot understand why.
It occurs when I try to set the value of a variable to one I set at the top
of the page. I have also tried it with getElementById (commented out) and
it gives me the same thing. The variable ssaleleasecode is getting the
undefined message. Can anyone spot the problem? Thanks. Below is the
Javascript code:
David
if ((document.getElementById('fvPropertyClosings_SaleTable') != null) ||
(document.getElementById('fvPropertyClosings_LeaseTable') != null))
var ssaleleasecode = '<%=strLeaseSaleCode %>';
//var obj = document.getElementById('txtSaleOrLease');
//var ssaleleasecode = obj.value;
alert('strLeaseSaleCode=' + ssaleleasecode);
if (ssaleleasecode == 'S')
{
var otbl =
document.getElementById('fvPropertyClosings_SaleTable');
otbl.className = 'Show';
otbl = document.getElementById('fvPropertyClosings_LeaseTable');
otbl.className = 'Hide';
calcpriceper();
}else{
if (ssaleleasecode == 'L')
{
var otbl =
document.getElementById('fvPropertyClosings_LeaseTable');
otbl.className = 'Show';
otbl = document.getElementById('fvPropertyClosings_SalesTable');
otbl.className = 'Hide';
}
}
aspx page. I am trying to show or hide 2 tables inside a FormView but I keep
getting the value in Javascript as "undefined" and I cannot understand why.
It occurs when I try to set the value of a variable to one I set at the top
of the page. I have also tried it with getElementById (commented out) and
it gives me the same thing. The variable ssaleleasecode is getting the
undefined message. Can anyone spot the problem? Thanks. Below is the
Javascript code:
David
if ((document.getElementById('fvPropertyClosings_SaleTable') != null) ||
(document.getElementById('fvPropertyClosings_LeaseTable') != null))
var ssaleleasecode = '<%=strLeaseSaleCode %>';
//var obj = document.getElementById('txtSaleOrLease');
//var ssaleleasecode = obj.value;
alert('strLeaseSaleCode=' + ssaleleasecode);
if (ssaleleasecode == 'S')
{
var otbl =
document.getElementById('fvPropertyClosings_SaleTable');
otbl.className = 'Show';
otbl = document.getElementById('fvPropertyClosings_LeaseTable');
otbl.className = 'Hide';
calcpriceper();
}else{
if (ssaleleasecode == 'L')
{
var otbl =
document.getElementById('fvPropertyClosings_LeaseTable');
otbl.className = 'Show';
otbl = document.getElementById('fvPropertyClosings_SalesTable');
otbl.className = 'Hide';
}
}