user1500702
user1500702

Reputation: 1

message on same page (not pop up) when value is >1. Javascript

basically i have a value "truecount" and if this value is less than one i want an error message on screen Not an alert popup.

sorry but im a noob

Upvotes: 0

Views: 417

Answers (3)

Zoltan Toth
Zoltan Toth

Reputation: 47667

Create a hidden element and change its' style to visible when your condition is met

if ( truecontent < 1 ) {
    document.getElementById("message").style.display = "block";
}


<div id="message" style="display: none">
    Your Message Here
</div>

DEMO

Upvotes: 1

yogi
yogi

Reputation: 19591

There are lots of ways to show a message like

  1. Showing alert box (But you don't want it).
  2. Showing message in a div which is initially hidden, and shows on message.
  3. Showing a popup div with any animation may be for good feel.

For more on div popups Go here or Here or Here

Upvotes: 0

kante
kante

Reputation: 229

Try considering using a javascript library like jquery. Place in your HTML a hidden layer

When it happens that your variable truecount becomes>1 just execute somthing like .... $('#ErrorReporting').html('Your alert Message').slideDown();

Upvotes: 1

Related Questions