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>

Recommended Answers

All 2 Replies

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.

Member Avatar for rajarajan2017
<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!.

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.