JavaScript for printing Welcome to JavaScript 1

Basic Concept:

You can use any type of html tag but it should be inside document.write(" ");

document.writeln : It is used to give the space between two statements.

<pre> : This tag means pre formatted text.


Basic Script for printing Welcome to JavaScript :

<!doctype html>
<!-- Welcome To JavaScript -->
<head>
<script type="text/javascript" language="javascript">
    document.writeln("Welcome To JavaScript");
    document.write('Welcome to CodingAtharva');
</script>
</head>

Output:



For Printing in two Separate Line by using pre tag:

<!doctype html>
<!-- Welcome To JavaScript -->
<head>
<pre>
<script type="text/javascript" language="javascript">
    document.writeln("Welcome To JavaScript");
    document.write('Welcome to CodingAtharva');
</script>
</pre>
</head>

For Printing in two Separate Line by using  br tag:

<!doctype html>
<!-- Welcome To JavaScript -->
<script type="text/javascript" language="javascript">
    document.writeln("Welcome To JavaScript");
      document.write('<br/>');
    document.write('Welcome to CodingAtharva');
</script>
</head>

Output: 



For Printing in style:

<!doctype html>
<!-- Welcome To JavaScript -->
<script type="text/javascript" language="javascript">
    document.writeln("<h1 style='color:blue;font-family:tahoma;font-size:40px'>Welcome To JavaScript</h1>");
      document.write('<br/>');
    document.write('Welcome to CodingAtharva');
</script>
</head>

Output:



Note: We can't use double cotation inside double cotation. It is mandatory to use double cotation inside single cotation.


In this all three thing is implemented that HTML, CSS and JavaScript that is DHTML(Dynamic HTML) This is an umbrella term in where collection of technologies together we are using.


Previous
Next Post »