Jump to content

Archived

This topic is now archived and is closed to further replies.

Aljade

If Statement Help

Recommended Posts

[code]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 = "";
    }
}[/code]

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!

Share this post


Link to post
Share on other sites
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+'[b]other_tax[/b]').style.display = "";
}
}
[/quote]
Anyway,, you could maybe try the eval() javascript function:
[code]
    if(document.proposal.tax_field.selectedIndex == 2) {
        eval("document.getElementById('job'+job_id+'other_tax').style.display = ''; ");
    }
[/code]

Good luck,

l8tr,,

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.