mardi 26 juillet 2016

input read through scan briefly appears and then resets instantly. How do I fix this?

I can't get this code block to work properly:

    <script>
        function Message(){
            document.getElementById("sname").innerHTML = document.getElementById("name").value;
        }
    </script>
</head>
<body>
    <form>
        <table>
            <tr>
                <td style="width:20%">User Name:</td>
                <td><input type="text" id="name" name="name" /></td>
            </tr>
            <tr><td>Password:</td><td><input type="password" name="password"/></td></tr>
            <tr>
                <td style="text-align:right">
                    <input type="submit" onclick="Message()"/>
                </td>
            </tr>   
        </table>     
    </form>
    <div>
        <p>Hi <span id="sname">0</span></p>
    </div>
</body>

Aucun commentaire:

Enregistrer un commentaire