开发者

javascript calling function

开发者 https://www.devze.com 2022-12-17 13:40 出处:网络
var macs = { getMacAddress : function() { document.macaddressapplet.setSep( \"-\" ); document.write( \"Mac Address = \" + document.macaddressapplet.getMacAddress() );
var macs = {
    getMacAddress : function()
    {
        document.macaddressapplet.setSep( "-" );
        document.write( "Mac Address = " + document.macaddressapplet.getMacAddress() );
    }

how do i call this function and display out in the website?

this doesn't see开发者_Python百科ms working..

<script type="text/javascript">
    document.write(mac.getMacAddress());
</script>

Anyone help?


Just use macs.getMacAddress();

The function doesn't return anything. It simply writes to the document. If you want it to return the string, replace document.write with return when you define macs.

Also, note that calling document.write after the page is loaded will overwrite the current page (because it implies document.open). If you need to append to the document after it's loaded, use the DOM or innerHTML.

0

精彩评论

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