I'm a newbie at this so couldn't figure this one out.

<html>
	<head>
	<title>Test JavaScript</title>
	
	</head>
<body>

	<script type="text/javascript">
		var frst=true;

		function first()
		{
			if(frst==true)
			{
				window.alert('Don't forget to Capitalize.');
			}
			frst=false;
		}
	</script>

	<form>
		<input type="button" value="Derke" onclick="first;" />
		
		<select>
			<option>color</option>
			<option>smell</option>
			<option>rain</option>
		</select>
		
		<br /><br /><br /><br /><br />

		<input type="text" onfocus="first;" />
	</form>
	
</body>
</html>

the onfocus handler isn't working. focusing on the textbox doesnt do anything.

Recommended Answers

All 2 Replies

couldn't figure this one out.

Syntax errors.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Test JavaScript</title>
  </head>
  <body>
      <script type="text/javascript">
        var frst = true;

        function first() {
            if (frst == true) {
                alert('Don\'t forget to Capitalize.');
            }
            frst = false;
        }
      </script>
	<form>
		<input type="button" value="Derke" onclick="first();" />
		
		<select>
			<option>color</option>
			<option>smell</option>
			<option>rain</option>
		</select>
		
		<br /><br /><br /><br /><br />

		<input type="text" onfocus="first();" />
	</form>
  </body>
</html>

You might find Firebug (or something similar) useful.

Thanks...I see it now, and feel like mashing my head against a wall for not seeing it before.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.