日期:2014-05-16  浏览次数:20341 次

js输出浏览器对象和生成日志的方法

?

<script type="text/javascript">
 function onmousedown(event) {
    var content = document.getElementById("ss");
    var output = event.type + ": <ul>";
    for (property in event) { //循环输出 event内的属性/值
        output += "<li>" + property + ": " + event[property] + "</li>";
    }
    console.log(output);
    content.innerHTML = output + "</ul>";
}
</script>
<p onmousedown="onmousedown" >点击我</p>
<div id="ss"></div>





?

?