...

View Full Version : getElementsByTagName('select') Issue.



pkrishnava
12-05-2006, 08:09 PM
i have 2 prompts


Beginning Year Month
&
EndYearMonth

I cant seem to get it work.this could be because i am using tagname.if i do by selectElementById(am not sure about the code),it doesnt work out.


<script>


var d=new Date()

var curMonth = d.getMonth();
var curYear = d.getFullYear();
if (curMonth == 0)
{ curYear = curYear - 1;
curMonth = 12
}
else
if(curMonth>=1 && curMonth<10)
{
curMonth="0"+curMonth;
}



var x1 = document.getElementsByTagName('select');

var RN_SelectName1 = "_listChoicesEYM";
var RN_SelectClass1 = "clsSelectControl";

for (var i=0;i<x1.length;i++)
{
if (x1[i].className != RN_SelectClass1) continue;
for (var j=0;j<x1[i].length;j++)
{

if (x1[i].options(j).value == curYear+curMonth.toString())
{
x1[i].selectedIndex = j;

}

}
eval('listBoxEYM.checkData()');
}

</script>




please help

thanks and have a nice day

pkrishnava
12-05-2006, 08:10 PM
right now it shows the same value in both the prompts. i want the beginning prompt to be 13 months before.even after the change,the same value comes in both the prompts.Help!!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum