ie调试控制台

时间:2022-09-18 09:58:32

function initConsole() {
var console = document.createElement('div');
console.id = 'errorConsole';
document.body.appendChild(console);
}

function writeToConsole(message){
var newMessage = document.createElement('p');
newMessage.innerHTML = message;
var console = document.getElementById('errorConsole');
console.appendChild(newMessage);
}

<script type="text/javascript">
$(document).ready(function () {
initConsole();
var browerObj = identifyBrowser();
if (browerObj.browser == "IE") {
writeToConsole("1234");
} else {
console.log("1234");
}
})
</script>