Aljade Posted April 11, 2006 Share Posted April 11, 2006 [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 More sharing options...
GBS Posted April 19, 2006 Share Posted April 19, 2006 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.