To demonstrate array objects and date object’s predefined methods using javascript.

Example of Array!!

Source Code:

<!DOCTYPE html>
<head>
<title>Js8</title>
</head>
<html>
<body>
<p>The toString() method returns an array as a comma separated string.</p>
<p id="demo"></p>
<hr>
    <a href="E:\documents\IM LAB\html\html3-mail link.html">Sanjampreet Singh</a>
    <br>
    <a href="http://sanjamhelping.blogspot.in/p/it-14304-it-methodologies-lab.html">Department Of Information Technology</a>
    <br>
    <a href="E:\documents\IM LAB\html\js7\js7_1.html"><-Last Practical</a>&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="E:\documents\IM LAB\html\js8\js8_1.html">Next Practical-></a>
   <br>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.toString();
</script>
</body>
</html>

Output:



Include the following source Code in Document Environment in your LaTeX File

LaTeX Source:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{transparent}
\usepackage{multirow}
\usepackage{eso-pic}
\usepackage[utf8]{inputenc}
\usepackage{color}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\BackgroundIm{
\put(0,0){
\parbox[b][\paperheight]{\paperwidth}{
\vfill
\centering
{\transparent{0.05} \includegraphics[height=\paperheight,width=\paperwidth,
keepaspectratio]{gne}
\vfill
}}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AddToShipoutPicture{\BackgroundIm}
\newpage
\section{\emph{To demonstrate array objects and date object’s predefined methods using javascript.}}
\subsection{\emph{Source Code:}}
\begin{verbatim}
<!DOCTYPE html>
<head><title>Js8</title></head>
<html>
<body>
<p>The toString() method returns an array as a comma separated string.</p>
<p id="demo"></p><hr>
<a href="E:\documents\IM LAB\html\html3-mail link.html">Sanjampreet Singh</a><br>
<a href="http://sanjamhelping.blogspot.in/p/it-14304-it-
methodologies-lab.html">Department Of Information Technology</a><br>
<a href="E:\documents\IM LAB\html\js7\js7_1.html"><-Last Practical</a>
<a href="E:\documents\IM LAB\html\js8\js8_1.html">Next Practical-></a><br>
<script>
var fruits = ["Banana", "Orange", "Apple", "Mango"];
document.getElementById("demo").innerHTML = fruits.toString();
</script>
</body>
</html>
\end{verbatim}
\subsubsection{\emph{Output:}}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{js8}
\caption{Output Of HTML page with Js}
\end{figure}
\end{document}

Output:




Date Objects

Source Code:

<!DOCTYPE html>
<html>
<head>
<title>JS8</title>
</head>
<body>
<p>The internal clock in JavaScript starts at midnight January 1, 1970.</p>
<p>The getTime() function returns the number of milliseconds since then:</p>
<p id="demo1"></p>
<p>The getFullYear() method returns the full year of a date:</p>
<p id="demo2"></p>
<p>The getDay() method returns the weekday as a number:</p>
<p id="demo3"></p>
<hr>
    <a href="E:\documents\IM LAB\html\html3-mail link.html">Sanjampreet Singh</a>
    <br>
    <a href="http://sanjamhelping.blogspot.in/p/it-14304-it-methodologies-lab.html">Department Of Information Technology</a>
    <br>
    <a href="E:\documents\IM LAB\html\js8\js8.html"><-Last Practical</a>&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="E:\documents\IM LAB\html\js9\js9.html">Next Practical-></a>
   <br>
<script>
var d = new Date();
document.getElementById("demo1").innerHTML = d.getTime();
document.getElementById("demo2").innerHTML = d.getFullYear();
document.getElementById("demo3").innerHTML = d.getDay();
</script>
</body>
</html>

Output:

Include the following source Code in Document Environment in your LaTeX File

LaTeX Source:

\documentclass[12pt]{article}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{transparent}
\usepackage{multirow}
\usepackage{eso-pic}
\usepackage[utf8]{inputenc}
\usepackage{color}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\BackgroundIm{
\put(0,0){
\parbox[b][\paperheight]{\paperwidth}{
\vfill
\centering
{\transparent{0.05} \includegraphics[height=\paperheight,width=\paperwidth,
keepaspectratio]{gne}
\vfill
}}}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\AddToShipoutPicture{\BackgroundIm}
\newpage
\section{\emph{To demonstrate array objects and date object’s predefined methods using javascript.}}
\subsection{\emph{Source Code:}}
\begin{verbatim}
<html>
<head>
<title>JS8</title>
</head>
<body>
<p>The internal clock in JavaScript starts at midnight January 1, 1970.</p>
<p>The getTime() function returns the number of milliseconds since then:</p>
<p id="demo1"></p>
<p>The getFullYear() method returns the full year of a date:</p>
<p id="demo2"></p>
<p>The getDay() method returns the weekday as a number:</p>
<p id="demo3"></p>
<hr>
<a href="E:\documents\IM LAB\html\html3-mail link.html">Sanjampreet Singh</a>
<br>
<a href="http://sanjamhelping.blogspot.in/p/it-14304-it-
methodologies-lab.html">Department Of Information Technology</a>
    <br>
    <a href="E:\documents\IM LAB\html\js8\js8.html"><-Last Practical</a>&nbsp;&nbsp;&nbsp;&nbsp;
    <a href="E:\documents\IM LAB\html\js9\js9.html">Next Practical-></a>
   <br>
<script>
var d = new Date();
document.getElementById("demo1").innerHTML = d.getTime();
document.getElementById("demo2").innerHTML = d.getFullYear();
document.getElementById("demo3").innerHTML = d.getDay();
</script>
</body>
</html>
\end{verbatim}
\subsubsection{\emph{Output:}}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{js8_1}
\caption{Output Of HTML page with Js}
\end{figure}
\end{document}

Output:

Comments

Popular posts from this blog

To implement the various components of HTML5 Canvas

Program to illustrate the concept of templates.

Program to illustrate the order of execution of constructors and destructors in inheritance.