To create a user defined function in javascript to get array of values and sort them in ascending order
Source Code:
<!DOCTYPE html>
<html>
<head>
<title>JS5</title>
</head>
<body>
<p>Click the button!!</p>
<button onclick="myFunction()">Try it</button>
<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\js4\js4.html"><-Last Practical</a>
<a href="E:\documents\IM LAB\html\js6\js6.html">Next Practical-></a>
<br>
<script>
var fruits = ["Banana","Orange","Apple","Mango"];
document.getElementById("demo").innerHTML=fruits;
function myFunction()
{
fruits.sort();
document.getElementById("demo").innerHTML=fruits;
}
</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 create a user defined function in javascript to get array of values and sort them in ascending order}}
\subsection{\emph{Source Code:}}
\begin{verbatim}
\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 create a user defined function in javascript to get array of values and sort them in ascending order}}
\subsection{\emph{Source Code:}}
\begin{verbatim}
<!DOCTYPE html>
<html>
<head><title>JS5</title></head>
<body>
<p>Click the button!!</p>
<button onclick="myFunction()">Try it</button>
<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\js4\js4.html"><-Last Practical</a>
<a href="E:\documents\IM LAB\html\js6\js6.html">Next Practical-></a><br>
<script>
var fruits = ["Banana","Orange","Apple","Mango"];
document.getElementById("demo").innerHTML=fruits;
function myFunction()
{fruits.sort();
document.getElementById("demo").innerHTML=fruits;}
</script>
</body>
</html>
\end{verbatim}
\subsubsection{\emph{Output:}}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{js5}
\caption{Output Of HTML page with Js}
\end{figure}
\end{document}
\subsubsection{\emph{Output:}}
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{js5}
\caption{Output Of HTML page with Js}
\end{figure}
\end{document}
Comments
Post a Comment