Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strange Problem

Status
Not open for further replies.

DKL01

Programmer
Sep 14, 2000
233
US
Hi,
When I run this code I get value 2 in text box. When I clear the text box and click on Test button I'm not getting alert. What could be the problem ? Thanks

<%@ Language=VBScript %>

<%
Dim Num
Num=2
%>

<html>
<head>

<script language=&quot;Javascript&quot;>

function Evaluate() {
if(document.form1.txtCategory==&quot;&quot;) {
alert(&quot;Empty&quot;);
}
}

</script>

</head>
<body >

<form name=form1>
<input type=&quot;text&quot; name=&quot;txtCategory&quot; id=&quot;txtCategory&quot; value=&quot;<%=Num%>&quot;>
<input type=&quot;button&quot; value=&quot;Test&quot; onclick=&quot;Evaluate()&quot;>
</form>
</body>
</html>
 


DKL01,

You need &quot;.value&quot; after &quot;txtCategory&quot;

if(document.form1.txtCategory.value==&quot;&quot;) {


Cheers,
fengshui1998
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top