html

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link href="../Content/StyleSheet3.css" rel="stylesheet" />
<script src="../Scripts/JavaScript3.js"></script>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<p id="p1">as</p>
<p id="p2">as</p>
</body>
</html>


js

window.onload = function () { 
setTimeout(p1fun,5000);
document.getElementById("p2").innerText = "我是p2";
};
var p1fun = function () {
document.getElementById("p1").innerText = "我是p1";
};


css