How to change background color in Javascript through function?
Example:
Code:
<html> <head> <script type="text/javascript"> function changecolor(color_code) { document.bgColor=color_code; } </script> </head> <body> </body> </html>
Example:
Code:
<html> <head> <script type="text/javascript"> function changecolor(color_code) { document.bgColor=color_code; } </script> </head> <body> </body> </html>
Example:
Code:
<html> <body> <script type="text/javascript"> { var txt="Shane Watson"; document.write(txt.replace("Watson","Harwood")); } </script> </body> </html>
Output:
Shane Harwood
Example:
Code:
<html> <body> <script type="text/javascript"> { var txt="JOHN"; document.write(txt.toLowerCase()); } </script> </body> </html>
Output:
john
Example:
Code:
<html> <body> <script type="text/javascript"> { var txt="John"; document.write(txt.toUpperCase()); } </script> </body> </html>
Output:JOHN
Example:
Code:
var a=1; for (a=1;a<=10;a++) { document.write("The number is " + a); document.write("
"); }
Output:
The number is 1
The number is 2
The number is 3
The number is 4
The number is 5
The number is 6
The number is 7
The number is 8
The number is 9
The number is 10