简体   繁体   中英

Pass javascript variable as javascript function parameter from HTML

I have a global javascript parameter declared at the top of my script: param2.

I am calling my function on body load.

I would like to pass my global javascript parameter to a javscript function.

<script language="javascript">
var param2;
...
function tableAppend(param1){
...
}
</script>

<body onload="tableAppend('param2');">

I am far from a professional with javascript, but I don't think there is a way to "concatenate" in HTML.

Could anyone point me in the right direction? I have seen answers on here about passing variables to a function, but not passing a javascript variable

愚蠢的我,如果其他人想知道答案,您只需要删除参数名称中的单引号即可!

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