Untitled

mail@pastecode.io avatar
unknown
plain_text
8 months ago
2.2 kB
1
Indexable
Never
<html>
    <head>
        <title>INST377 - Lab 4</title>
        <link rel = "stylesheet" href="lab4.css"
    </head>
    <body>
        

        <!-- Main Text Area -->
        <div class = "main-container">
            <h1 id = "INST">INST377 - Lab 4</h1>

            <!-- Box 1 Alert Me Section -->
            <div class = "content-box1">
                <h1>Box 1</h1>
                <form name = "nameForm" onsubmit="return(validate())">
                    <label>Name</label>
                    <input type = "text" id="firstName">
                    <input type ="submit" value ="Alert Me!">
                </form>
            </div>

            <!-- Box 2 Change Color Section -->
            <div class = "content-box2">
                <h1>Box 2</h1>
                <form name = "changeColor">
                    <input type ="submit" value ="Change Coor">
                </form>

            </div>

            <!-- Box 3 Text Tester Section -->
            <div class = "content-box3">
                <h1>Box 3</h1>

            </div>

            <!-- Box 4 Add Text Section -->
            <div class = "content-box4">
                <h1>Box 4</h1>

            </div>

        </div>

        <!-- Script for Box 1 Alert Me Section -->
        <script type ="text/javascript">
            function validate() {
                var validation = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]+/;
                if (document.nameForm.firstName.value == "") {
                    alert("Enter a first name!")
                    return false;
                } else if (validation.test(document.nameForm.firstName.value)) {
                    alert("how about.. no.");
                    return false;
                }
                return true;
            }
            
            function hiAlert(){
                var firstNameValue = document.getElementById("firstName").value; 
                    if (firstNameValue == firstNameValue) {
                        alert("Hi " + firstNameValue + "!");
                    
                        return false;
                    }
                
                
            }
                        


            
        </script>
    </body>
</html>
Leave a Comment