0

I don't get what's wrong. The text box is there and the button is there, but nothing's happening.

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

	<script>
		var col=3;

		fucntion randy()
		{
			col++; col%=10;
			col+=4;	col*=45;
			col/=10;
		}
		
		function funny(num)
		{
			if(num=>10){num=num%10;}
			if(num>=5){num=num-5;}

			if(num==0)
				{return "Marry had a little lamb.";}
			else if(num==1)
				{return "Ba ba blacksheep.";}
			else if(num==2)
				{return "Twinkle twinkle little star.";}
			else if(num==3)
				{return "One two, tie yur shoe.";}
			else if(num==4)
				{return "Don't remember any others.";}
			return "Ha ha!";
		}				
	</script>

	</head>
	
<body>
		
		
	
	<input type="button" value="Click me!" id="daButton" />
	<input type="text" value="Now you'll see some fun." id="textBox" />

	<script>
	document.write("Testing");
	</script>
	
	<script>
	var tB=document.getElementById("textBox");
	var dB=document.getElementById("daButton");
	
	tB.onmouseover=function(){tB.value="No point in typing anything.";};
	tB.onfocus=fucntion(){tB.value="You insist on typing!";};
	dB.onclick=fucntion(){tB.value=funny(col); randy();}; 
	</script>	
	
</body>
</html>
3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by rajarajan07
0

I don't get what's wrong.

fucntion randy()
			if(num=>10){num=num%10;}
	<input type="button" value="Click me!" id="daButton" />

1. Spelling.
2. Syntax.
3. I could suggest <input type="button" id="daButton" value="Click me!" onclick="randy();tB.value=funny(col)"> and other fixes but I stopped reading.

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

	<script>
		var col=3;

		function randy()
		{
			col++; col%=10;
			col+=4;	col*=45;
			col/=10;
		}
		
		function funny(num)
		{
			if(num>=10){num=num%10;}
			if(num>=5){num=num-5;}

			if(num==0)
				{return "Marry had a little lamb.";}
			else if(num==1)
				{return "Ba ba blacksheep.";}
			else if(num==2)
				{return "Twinkle twinkle little star.";}
			else if(num==3)
				{return "One two, tie yur shoe.";}
			else if(num==4)
				{return "Don't remember any others.";}
			return "Ha ha!";
		}				
	</script>

	</head>
	
<body>
		
		
	
	<input type="button" value="Click me!" id="daButton" />
	<input type="text" value="Now you'll see some fun." id="textBox" />

	<script>
	document.write("Testing");
	</script>
	
	<script>
	var tB=document.getElementById("textBox");
	var dB=document.getElementById("daButton");
	
	tB.onmouseover=function(){tB.value="No point in typing anything.";};
	tB.onfocus=function(){tB.value="You insist on typing!";};
	dB.onclick=function(){tB.value=funny(col); randy();}; 
	</script>	
	
</body>
</html>

Are you a typing master? LOL only the erros are the spelling mistakes,
Just to point out:
=> should be >=
fnction should be function.

Be cautious on typing those things. Have a habit of debugging!.

This topic has been dead for over six months. 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.