我搜索了很多网站,而且我已按照说明做了所有事情,但我的代码仍无法使用。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Cím</title>
<style>
#yourname {
color: red;
font-size: 16pt;
}
#yourbday {
color: blue;
font-weight: bold;
font-size: 16pt;
}
</style>
<script>
function starting(yname, ybday){
alert ("Hi");
var yname = prompt ("What's your name?");
var ybday = prompt ("What's your age?", "20");
document.write("<span id='yourname'>" + yname + "</span>");
}
</script>
</head>
<body onload="starting()">
</body>
但是,在正文中,您的名称字符串未格式化。我怎么解决这个问题?谢谢!