简体   繁体   中英

How to call multiple functions in Javascript

I have 4 functions that are basically the same, but with a different value..

function choose(value){
            document.getElementById('templatefield').text=value;
            if(value!=='alliance_update'){
                document.getElementById('textentrydiv').style.display='none';
                document.getElementById('textentrydiv').style.visibility='hidden';
            }
            document.forms[0].setAttribute('action','send_email.php?template='+value);
        }

if i write the functions down in a script.. it reads the last function.. and none of the others work..

i have tried an if else that didn't work.. can i pass the value to an array??

var templatesjs= new Array( "custom", "update", "client", "realtor" );

if i can do that.. how do i pass it into the value if(value!=='GOES HERE')

is this even possible.. and if not.. how do i make it possible??

Thank You

The answer to the question.. was

if(value!=='alliance_update' && value!=='custom' && value!=='realtorNewsletter' && value!=='clientNewsletter') ....rest of function   

basically how to combine all those function objects that are doing the same thing in one.. not sure if they are function objects, or key values... or values. :-/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM