Escriure i llegir valor en entrada html

<!DOCTYPE html>

<html lang=»en»>

<head>

    <meta charset=»UTF-8″>

    <title>Document</title>

</head>

<body>

    <!–<input type=»text» id=»id_name» name=»name» value =»<?echo $_POST[name]; ?>» > –>

    <input type=»text» id=»id_name» >

<script>

document.getElementById(«id_name»).value = «urqt»; //escriu valor

</script>

<script >

a= document.getElementById(«id_name»).value //llegeix valor

</script>

<script>

    alert(a); //valor llegit

</script>

</body>

</html>


Shift F6

Deixa un comentari

L'adreça electrònica no es publicarà. Els camps necessaris estan marcats amb *

This site uses Akismet to reduce spam. Learn how your comment data is processed.