Untitled

 avatar
unknown
plain_text
3 years ago
2.5 kB
1
Indexable
<!DOCTYPE html>
<html>
<head>
    <title>html formu</title>
    <script language="JavaScript">
        function Kaydet(){
            if(document.frm1.txtName.value==""){
                window.alert("isim alanı zorunludur!");
            }
            if(document.frm1.txtSurname.value==""){
                window.alert("soyisim alanı zorunludur!")
            }
            if(document.frm1.txtAdress.value==""){
                window.alert("Adres alanı zorunludur!")
            }
            else{
                window.alert("Kaydetme Başarılı!")
            }
        }
        function Yukle(){
            const Person = {
                name:"Bekir",
                surname:"Karakulak",
                adres:"İstanbul"
            };



            document.frm1.txtName.value= Person.name;
            document.frm1.txtSurname.value=Person.surname;
            document.frm1.txtAdress.value=Person.adres;

        }




    </script>

</head>

<body>
    

<form name="frm1" >


    <center>
        <br>
        <br>
        <table border="3" width="60%" style=" border: lightseagreen; border-collapse: collapse;">
            <tr style="background-color: lightgreen;">
                <td width=40%>Ad</td>
                <td width=60% ><input type="text" name="txtName" id="txtName" style="color:black; background-color:lightsteelblue;"></td>
            </tr>
            <tr style="background-color: lightgreen;">
                <td>Soyad</td>
                <td><input type="text" name="txtSurname" id="txtSurname" style="color:black; background-color:lightsteelblue;"></td>
            
            </tr>
            <tr style="background-color: lightgreen;">
                <td>Adres</td>
                <td><input type="text" name="txtAdress" id="txtAdress" style="color:black; background-color:lightsteelblue;"></td>
            
            </tr>
            
        
        </table>
            <br>
        
        <input type="button" name="btnYukle" id="btnYukle" value="Yükle" style="background-color: lightyellow; color: mediumblue; width: 100px; height: 40px; " onclick="Yukle()">    
        <input type="button" name="btnKaydet" id="btnKaydet" value="Kaydet" style="background-color: lightyellow; color: mediumblue; width: 100px; height: 40px; " onclick="Kaydet()">    

        
    
    </center>




</form>


</body>




</html>