我想通过一段javascript脚本,通过点击按钮事件让上面的字母全部变为大写,请问这代码有问题么?
<html><head><styletype="text/css">#box{width:803px;height:100%;margin:0pxauto;backgro...
<html>
<head>
<style type="text/css">
#box{
width:803px;
height:100%;
margin:0px auto;
background-color:#F69;
}
#buttom{
width:800px;
height:auto;
float:left;
}
</style>
</head>
<body>
<div id="box">
<h1 id="up">this is my first HTML.</h1>
<input name="按钮" type="button" value="请点击" onclick="Myfunction()" />
<div id="bottom"><p id="demo"></p></div>
</div>
<script type="text/javascript">
function Myfunction()
{
var x=document.getElementById("up").value;
var y=x.toUpperCase();
document.getElementById("demo").innerHTML=y;
}
</script>
</body>
</html>
点击按钮怎么就实现不了呢?要怎么编写代码啊?求高手解答!谢谢 展开
<head>
<style type="text/css">
#box{
width:803px;
height:100%;
margin:0px auto;
background-color:#F69;
}
#buttom{
width:800px;
height:auto;
float:left;
}
</style>
</head>
<body>
<div id="box">
<h1 id="up">this is my first HTML.</h1>
<input name="按钮" type="button" value="请点击" onclick="Myfunction()" />
<div id="bottom"><p id="demo"></p></div>
</div>
<script type="text/javascript">
function Myfunction()
{
var x=document.getElementById("up").value;
var y=x.toUpperCase();
document.getElementById("demo").innerHTML=y;
}
</script>
</body>
</html>
点击按钮怎么就实现不了呢?要怎么编写代码啊?求高手解答!谢谢 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询