开发者

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


Silly me, if anyone else is wondering about the answer, you simply need to remove the single quotes from the parameter name!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜