dongqie2355 2011-11-23 11:20
浏览 25
已采纳

来自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?

  • 写回答

3条回答 默认 最新

  • dongyong5255 2011-11-23 11:25
    关注

    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);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?