I have this code, and body
<body onload="mail_receive()">
won't execute it.
function mail_receive() {
document.getElementById("w")="mail receive";
}
It won't show in
<div id="w"></div>
You can't assign a string value to a DOM element and expect it to work. (In fact you probably can't use the result of a function call as an lvalue in Javascript to begin with.)
Try
document.getElementById('w').innerHTML = 'Mail received';
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.