0

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.

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by kaylors
0

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.

0

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

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.