Click to See Complete Forum and Search --> : Message Popop on no input


chapimp
01-24-2003, 08:24 PM
Hi, if someone can help me with this.

Im trying to display HTML when it is inserted into this Textbox,
this works, but I also want a massage popup olny if the user does not input nothing.

How colud I do it?

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function displayHTML(form) {
var inf = form.htmlArea.value;
win = window.open(", ", 'popup', 'toolbar = no, status = no');
win.document.write("" + inf + "");
}
// End -->
</script>

<form>
<textarea name="htmlArea" cols=45 rows=6></textarea>
<br>
<input type="button" value=" view " onclick="displayHTML(this.form)">
</form>

Jona
01-24-2003, 08:46 PM
if(inf=="") {
alert("Please put something in the box!")
} else if(inf==" ") {
alert("Please put something in the box!")
}

In the main function right after you put:
var inf = form.htmlArea.value

slynx
01-24-2003, 08:50 PM
if (form.htmlArea.value == "")
alert('Enter data");

Jona
01-24-2003, 08:53 PM
Slyx, you put an apostrophe and then a quote. Your alert should be:

alert("Enter Text")

or

alert('Enter Text')

:)

slynx
01-24-2003, 09:13 PM
Yeah ...my fingers don't want ot type tonight

chapimp
01-25-2003, 01:40 AM
thanks for the help....

they all work fine