anonymous No title
No License HTML
2020年10月17日
Copy Clone
<!DOCTYPE html>
<html lang="ja">
<head>
    <link rel="stylesheet" href="kadai5_3.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1 id="title">タイトル</h1>
    <form>
        <input id="1" type="text">
        <input onclick="mk_title()" type="button" value="タイトルを変更"><br/>
    </form>
    <form>
        <input onclick="blue()" type="button" value="青"><br/>
    </form>
    <form>
        <input onclick="red()" type="button" value="赤"><br/>
    </form>
    <form>
        <input onclick="yellow()" type="button" value="黄"><br/>
    </form>
    <script>
        function mk_title(){
            document.getElementById("title").innerHTML=document.getElementById("1").value;
            document.getElementById("1").value="";
        }
        function blue(){
            document.getElementById("title").style.backgroundColor="blue";
            document.getElementById("title").style.color="white";
        }
        function red(){
            document.getElementById("title").style.backgroundColor="red";
            document.getElementById("title").style.color="white";
        }
        function yellow(){
            document.getElementById("title").style.backgroundColor="yellow";
            document.getElementById("title").style.color="black";
        }
    </script>
</body>
</html>
<!DOCTYPE html>
<html lang="ja">
<head>
    <link rel="stylesheet" href="kadai5_3.css">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1 id="title">タイトル</h1>
    <form>
        <input id="1" type="text">
        <input onclick="mk_title()" type="button" value="タイトルを変更"><br/>
    </form>
    <form>
        <input onclick="blue()" type="button" value="青"><br/>
    </form>
    <form>
        <input onclick="red()" type="button" value="赤"><br/>
    </form>
    <form>
        <input onclick="yellow()" type="button" value="黄"><br/>
    </form>
    <script>
        function mk_title(){
            document.getElementById("title").innerHTML=document.getElementById("1").value;
            document.getElementById("1").value="";
        }
        function blue(){
            document.getElementById("title").style.backgroundColor="blue";
            document.getElementById("title").style.color="white";
        }
        function red(){
            document.getElementById("title").style.backgroundColor="red";
            document.getElementById("title").style.color="white";
        }
        function yellow(){
            document.getElementById("title").style.backgroundColor="yellow";
            document.getElementById("title").style.color="black";
        }
    </script>
</body>
</html>
No one still commented. Please first comment.