Jump to content

If Statement Help


Aljade

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!

Link to comment
https://forums.phpfreaks.com/topic/7081-if-statement-help/
Share on other sites

  • 2 weeks later...
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,,
Link to comment
https://forums.phpfreaks.com/topic/7081-if-statement-help/#findComment-28794
Share on other sites

Archived

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

×
×
  • Create New...

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.