开发者

How do you include a javascript variable in a hyperlink?

I have pretty simple code

<input type="hidden" name=passtophp value=variable>

The variable is created in javascript in the head of the document. Unfortunately when I put in the variable name it is captured as a string and passed through instead of the variable's actual value. How can I pass through 开发者_如何学Cthe variable's value? Thank you!!


var myVariable = 'myValue';
document.getElementById('passtophp').value = myVariable ;

Ensure you specifty an ID on the hidden field though.

<input type="hidden" name='passtophp' id='passtophp' />
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜