Hi.
I'm having a problem regarding access of the onclick event of a dropdownlist in javascript. It seems that during the onclick event, the javascript cannot catch the SelectedIndex that I chose..rather..it always defaults to the 0 index:
Here's the code:
<script language='javascript'>
<!--
if(document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0')!=null){
document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0').onclick = Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0_OnClick;}else{}
function Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0_OnClick(){
var returnValue = null;
var strListItem = '2|3';
var arrListItem = strListItem.split('|');
var selectedIndex = document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0').selectedIndex;
alert(selectedIndex);var bFound = false;
for (var i=0; i < arrListItem.length; i++){
if (selectedIndex == arrListItem){
bFound = true;
break;}}alert(bFound);
if (bFound){
if(document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_txtChange')!=null){
if(document.all('Contentcontainer1__ctl0_Region3_txtChange').value=='changed'||document.all('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_txtChange').value!=''){
returnValue = confirm('Your updates have not been saved. Click OK to continue going to the previous page, CANCEL to retain current page.')}}
else{
if(document.all('Contentcontainer1__ctl0_Region3_txtChange').value=='changed'){
returnValue = confirm('Your updates have not been saved. Click OK to continue going to the previous page, CANCEL to retain current page.')}}}}
document.all('Contentcontainer1__ctl0_Region3_ReturntxtChange').value = returnValue;
if(returnValue==null){}else{
if(returnValue){}else{return false;}}
}
//-->
</script>
Thanks for the help
I'm having a problem regarding access of the onclick event of a dropdownlist in javascript. It seems that during the onclick event, the javascript cannot catch the SelectedIndex that I chose..rather..it always defaults to the 0 index:
Here's the code:
<script language='javascript'>
<!--
if(document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0')!=null){
document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0').onclick = Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0_OnClick;}else{}
function Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0_OnClick(){
var returnValue = null;
var strListItem = '2|3';
var arrListItem = strListItem.split('|');
var selectedIndex = document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_dgSRP1__ctl2_NeedTo0').selectedIndex;
alert(selectedIndex);var bFound = false;
for (var i=0; i < arrListItem.length; i++){
if (selectedIndex == arrListItem){
bFound = true;
break;}}alert(bFound);
if (bFound){
if(document.getElementById('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_txtChange')!=null){
if(document.all('Contentcontainer1__ctl0_Region3_txtChange').value=='changed'||document.all('Contentcontainer1__ctl0_Region3_ucCurrentFilledRoles_txtChange').value!=''){
returnValue = confirm('Your updates have not been saved. Click OK to continue going to the previous page, CANCEL to retain current page.')}}
else{
if(document.all('Contentcontainer1__ctl0_Region3_txtChange').value=='changed'){
returnValue = confirm('Your updates have not been saved. Click OK to continue going to the previous page, CANCEL to retain current page.')}}}}
document.all('Contentcontainer1__ctl0_Region3_ReturntxtChange').value = returnValue;
if(returnValue==null){}else{
if(returnValue){}else{return false;}}
}
//-->
</script>
Thanks for the help