CSS + JS Alert in HTML

How we make error/invalid/empty/ alert message show in red box like mentioned in image.

I am using this code but not using java… Becouse I have bit knowledge about java …

<!DOCTYPE html>
                <meta charset="utf-8">

                                        <meta http-equiv="content-type" content="text/html; charset=utf-8">
                <title>Client Log In</title>

                <Style>body{background-color:#f9f9f9}body,input,button{color:#444;font:12px "Lucida Sans Unicode","Lucida Grande",sans-serif}a{color:#2e6e9e}#login{position:absolute;top:50%;left:50%;margin:-230px 0 0 -258px;width:500px;background:#fff}#login{border:5px
solid #5e9dcd;-moz-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;-moz-box-shadow:0 2px 5px #4e707c;-webkit-box-shadow:0 2px 5px #4e707c;box-shadow:0 2px 5px #4e707c}#login a:hover{color:#111}#login
23px;color:#fff;font-size:14px;border:0;border-bottom:1px solid #007dab;background-color:#5e9dcd;text-shadow:0 1px 0 #007dab}#login
solid #c1c1c1;box-shadow:0 1px 4px rgba(0, 0, 0, 0.16) inset;-webkit-box-shadow:0 1px 4px rgba(0, 0, 0, 0.16) inset;-moz-box-shadow:0 1px 4px rgba(0, 0, 0, 0.16) inset}#login
25px;text-align:left;background:none}#login div.submit
30px;height:30px;line-height:30px;text-align:center;font-size:12px;color:#fff;text-shadow:0 1px 0 #007dab;cursor:pointer;border:0;background:#5e9dcd;-moz-border-radius:50px;-webkit-border-radius:50px;border-radius:50px}#login
0;text-align:left;font-size:11px;border-top:1px solid #eee}#login
25px 10px;padding:8px
8px 8px 30px;text-align:left}#login #message .ui-icon{position:absolute;top:50%;left:7px;margin-top:-8px}#footer{position:absolute;bottom:10px;left:0;width:100%;color:#666;font-size:11px;text-align:center}</style>

                <div id="notify-top"><ul></ul></div>
                <div id="notify-right"><ul></ul></div>
                <div id="notify-overlay" class="ui-widget-overlay"></div>
                <form id="login" method="post" action=" ">

                        <h1>Welcome! Please enter your credentials to log in</h1>
                <label for="client">Client ID or E-mail:</label>
                <input class="field required" type="text" name="client">

                <label for="password">Password:</label>
                <input class="field required" type="password" name="password">

        <p class="forgot">
                <a href="/lostpassword.html" title="Forgot your password?">Forgot your password?</a>

        <div class="submit">

                <button type="submit">Log in</button>

        <p class="back"></p>

                <div id="footer">
                        &copy; Copyright 2003 - 2018 - All rights reserved.                </div>

Are you referring to JavaScript or Java? These are two totally different languages. I think you mean JavaScript.

You can also make a message like this in PHP when you do your server-side validation.

Are you asking how to create an alert message when the fields have not been completed, or how to style an alert message tto look like the one in the image?

I mean how we make like that alert when filed having some error, invalid, empty, etc.

Oops!! Sorry, I meant JavaScript.

I’m presuming you’ve copied this from another site. (The “Copyright 2003 - 2018” gives me that impression, among other things.) Why not look at the JS on that site and see how it is done there?

The HTML you’ve provided does not contain the error message, which suggests you’ve acquired it using view source, rather than the version rendered in the DOM. It would appear that the error message has been injected using JavaScript at some point. It would be useful if we could see the JavaScript from the page concerned.

1 Like

No actually I was not think about that what I edit bottom of the page becouse generally I seen on every website at footer some copyright year, and all rights reserved text mentioned same thing happened with me. I also want to make this page looking pretty that why I use 2003 to 2018 . From 2003 becouse I joined the primary school. And 2018 becouse this is currently year.

I am not copy from other website…

I make that alert via PicArt App in mobile and designed it…

Suppose show error when minlength 5 or maxlength is 10. If visit enter below 5 and above 10 show error

<input type="text" name "demo" minlength="5" maxlength="10">

If textbox is required and when it empty

<input type="text" name "demo" required>

When required title show like

<input type="text" name "demo" pattern=" " title="Please enter your client" required>

Really? Because it looks almost exactly like the form found on this page: https://cp1.runhosting.com/beta/login/?next=start&notice=login, right down to the copyright notice and the classes used in the HTML.


I was don’t know about it … that it is bit looks likes me…
But My look is different …:fearful:
It just a coincidence


.errorbox {border:1px solid #aa0000; margin:0px; margin-top:5px; margin-bottom:5px; background-color:#fff0f0; padding-top:5px; padding-bottom:5px; padding-left:5px; padding-right:5px;}
.errortitle {color:#cc0000; font-size:12pt; font-weight:bold;}

What would be the Js

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.