Jump to content


Photo

If Statement Help


  • Please log in to reply
1 reply to this topic

#1 Aljade

Aljade
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 11 April 2006 - 01:38 AM

function showHideOtherTax(job_id) {
    var tax_field = 'job'+job_id+'other_tax'; 
    
    if(document.proposal.tax_field.selectedIndex == 2) {
        document.getElementById('job'+job_id+'other_tax_div').style.display = "";
    }
}

The if statement doesn't work in this function. If type in say job1othertax instead of using tax_field it works, but I need it to work according to what job_id is. How can I fix this?

Thanks!



#2 GBS

GBS
  • Members
  • PipPipPip
  • Advanced Member
  • 108 posts

Posted 19 April 2006 - 11:46 PM

Hi there,

I'm not sure,, but,, maybe you have a typo mistake there, between 'other_tax' / 'other_tax_id',...
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
function showHideOtherTax(job_id) {
var tax_field = 'job'+job_id+'other_tax';

if(document.proposal.tax_field.selectedIndex == 2) {
document.getElementById('job'+job_id+'other_tax').style.display = "";
}
}
[/quote]
Anyway,, you could maybe try the eval() javascript function:
    if(document.proposal.tax_field.selectedIndex == 2) {
        eval("document.getElementById('job'+job_id+'other_tax').style.display = ''; ");
    }

Good luck,

l8tr,,
Sorry for my english,... I do my best, but sometimes,...
1st intention: understand the problem
2nd intention: try to solve it
3rd intention: try to understand how to solve it :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users