Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.