来自HTML / PHP的Javascript函数参数

my question is really basic but I really can't figure out how to do it.

Basically I have a javascript function into an HTML document that changes my uploading parameters as follows:

function change(){
upload.url ( 'upload.php?country=COUNTRYISOSTRING' );
}

Now, basing on a selection made by the user through PHP or HTML function (such as IP country detection or simple HTML dropdown menu), I would like to change the COUNTRYISOSTRING passing it to the function instead of writing different functions for each choice, so it would become

function change($countrycode) {
upload.url ( 'upload.php?country=$countrycode' );
}

But it's not working...What am I doing wrong?

I don't really understand what you are exactly trying to do but something like this should definitively work:

function change(country){
upload.url ( 'upload.php?country=' + country);
}

Edit: misunderstood the question. In JavaScript variables don't need the dollar sign, and are not evaluated inside strings; you need to concatenate the parameter like this:

function change(countrycode) {
    upload.url ( 'upload.php?country=' + countrycode );
}

Better to pass your php variable as a parameter to the function call:

function change(countryCode) {
    upload.url('upload.php?country=' + countrycode);
}

And call this function like:

change('<?php echo $countryCode; ?>')