开发者

New to JavaScript and need help on my first program

I'm trying to add a function to my website so when the user clicks on a footnote the browser will display it inline. Here is how far I have gotten,

var locate= document.getElementById("footnote1");
var note= document.getElementById(&开发者_Go百科quot;footnotes2");
function footnote() {
    locate.onclick= note.style.display="inline";
};

any help would really be appreciated.


Here is an example of what you want.

var locate = document.getElementById("footnote1");
var note = document.getElementById("footnotes2");
locate.onclick = function() {
    note.style.display = "inline";
};


Working Example

http://jsfiddle.net/v8fHE/

you just had to wrap the onclick action in a function

trigger.onclick=function(){toChange.style.background="#FF0000"};
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜