0% found this document useful (0 votes)
37 views

Css Imp Codes

Uploaded by

Pankaj Sangale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views

Css Imp Codes

Uploaded by

Pankaj Sangale
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

crceate a pull-down menu: <BR>

<A onmouseover=
<html> "document.cover.src='rose.jpg'">
<head> <B><U>Rose</U></B>
<title>HTML Form</title> </A>
<script> </TD>
function getPage(choice) </TR>
{ </TBODY>
page=choice.options[choice.selectedIndex].value; </TABLE>
if(page != "") </body>
{ </html>
window.location=page;
}
} slideshow with the group of three images :
</script> <html>
</head> <head><script>
<body> pics = new Array('1.jpg'
<select name="MenuChoice" onchange="getPage(this)"> , '2.jpg' , '3.jpg'); count
<option = 0;
value="https://www.google.com">Google</option> function slideshow(status)
<option {
value="https://www.msbte.org.in">MSBTE</option> if (document.images)
<option { count = count + status; if (count > (pics.length - 1))
value="https://www.yahoo.com">Yahoo</option> {
</form> count = 0;
</body> }
</html> if (count < 0)
{
count = pics.length - 1;
}
documet.imag1.src = pics[count];
}
}
</script>
</head>
<body>
<html> <img src="1.jpg" width="200" name="img1">
<head> <br>
<title>Frame Demo</title> <input type="button" value="Next"
</head> onclick="slideshow(1)">
<body> <input type="button" value="Back"
<table border="1"> onclick="slideshow(-1)"> </body>
<tr> </html>
<td align="center" colspan="2">
FRAME 1 Regular Expression:
</td> A regular expression is very similar to a
</tr> mathematical expression, except a regular
expression tells the browser how to manipulate
<tr>
text rather than numbers by using special
<td>
symbols as operators.
FRAME 2
<ul> Search() method:
<li> str.search() method takes a regular
<a href="fruits.html" target="mainframe">FRUITS</a> expression/pattern as argument and
</li> search for the specified regular expression
<li> in the string. This method returns the index
<a href="flowers.html" target="mainframe">FLOWERS</a> where the match found.
</li>
<li> Example:
<a href="cities.html" target="mainframe">CITIES</a>
</li> <html>
</ul> <body>
</td> <script>
<td> function myFunction() {
FRAME 3<BR> var str = "Good Morning!";
<iframe name="mainframe"></iframe> var n
</td> =str.search(/Mor
</tr> ning/i);
</table> document.write(n + '<br>');
</body> var n = str.search(/Morning/);
</html> document.write(n);
}
text rollover: myFunction();
You create a rollover for text by </script>
using the onmouseover </body>
attribute of the <A> tag, which </html>
is the anchor tag. You assign
the action to the onmouseover display 5 elements of array in sorted order :
attribute the same way as you
do with an <IMG> tag. <html>
Code:
<head>
<html>
<title> Array</title>
<head>
</head>
<title>Rollover Text</title>
<body> <script> var
</head>
<body> arr1 = [ “Red”, “red”,
<TABLE width="100%" border="0">
<TBODY> “Blue”, “Green”]
<TR vAlign="top">
<TD width="50"> document.write(“Bef
<a> ore sorting arra1=” +
<IMG height="92" src="rose.jpg" width="70" border="0" name="cover">
</a> arr1);
</TD>
<TD> document.write(“<br>After sorting arra1=” + arr1.sort());
<IMG height="1" src="" width="10"> </script>
</TD> </body>
</html>
<TD>
<A onmouseover= "document.cover.src='sunflower.jpg'">
<B><U>Sunflower</U></B>
</A>
<BR>
<A onmouseover=
"document.cover.src='jasmine.jpg'">
<B><U>Jasmine</U></B>
</A>
create Rotating Banner Ads : Rollover : it means a webpage changes
<html > when the user moves his or her mouse
<head> over an object on the page. It is often used
<title>Banner Ads</title> in advertising. There are two ways to
<script> create rollover, using plain HTML or using a
Banners = new Array('1.jpg','2.jpg','3.jpg'); mixture of JavaScript and HTML. We will
CurrentBanner = 0; function DisplayBanners()
demonstrate the creation of rollovers using
{ if (document.images);
{ both methods.
CurrentBanner++; The keyword that is used to create rollover
if (CurrentBanner == Banners.length) is the <onmousover> event.
{
session cookie ?
CurrentBanner = 0;
Session cookies are temporary cookies that
}
remember users online activities
document.RotateBanner.src= Banners[CurrentBanner];
throughout a session it remember the
setTimeout("DisplayBanners()",1000);
information when a user in until logout or
}
when user close the web page.when a user
}
gets logged out the session cookies gets
</script> expired.
</head>
<body onload="DisplayBanners()" > a) setTimeout() the setTimeout()function
<center> allows you to schedule a specified function
<img src="1.jpg" width="400" height="75" name="RotateBanner" /> to trigger at a specific time from the
</center> current time. syntax:
</body> setTimeout(function,time);
</html>
<html>
input for user name and password : <script>
<html> Function myfunction()
<head> <script> {
setTimeout(displayFunction,500);
function storeCookie()
}
{ Function displayFunction()
= "Password=" + pwd + ";" {
alert("Cookie Stored\n"+document.cookie); alert(“Time out”);
} }
</script> </script>
<body>
</head>
<p>Click to set the time out</p>
<body> <input type=”button” value=”Set Time
<form name="myForm"> Out” onclick=”myFunction();”/>
Enter Username <input type="text" id="uname"/><br/> </body>
Enter Password <input type="password" id="pwd"/><br/> </html>
<input type="button" value="Submit" onclick="storeCookie()"/>
concat()
<p id="panel"></p>
The concat() method concatenates (joins) two or more
</form> arrays.
</body> The concat() method returns a new array, containing
the joined arrays.
</html>
The concat() method separates each value with a
comma only.
Syntax:
array1.concat(array2, array3, ..., arrayX)
Example: <script> const
arr1 = ["CO", "IF"];
const arr2 = ["CM",
"AI",4]; const arr =
<script> arr1.concat(arr1, arr2);
function validateForm() { document.write(arr);
var name = document.getElementById("name").value; </script>
var email = document.getElementById("email").value;
var pinCode = document.getElementById("pinCode").value; join()
The join() method returns an array as a string.
if (name === "") { Any separator can be specified. The default is comma (,).
alert("Name cannot be blank."); Syntax:
return false; array.join(separator)
} Example:
<script>
var fruits = ["Banana", "Orange",
if (email === "") {
"Apple", "Mango"];
alert("Email cannot be blank."); var text = fruits.join();
return false; document.write(text); var text1 =
} fruits.join("$$");
document.write("<br>"+text1);
if (pinCode === "") { </script>
alert("Pin Code cannot be blank.");
return false;
}

if (!/^\d{6}$/.test(pinCode)) {
alert("Pin Code must contain 6 digits.");
return false;
}

return true;
}
</script>
<form onsubmit="return validateForm()">
<label for="name">Name :</label>
<input type="text" id="name" name="name">
<br>
<label for="email">Email :</label>
<input type="email" id="email" name="email">
<br>
<label for="pinCode">Pin Code:</label>
<input type="text" id="pinCode" name="pinCode">
<br>
<input type="submit" value="Submit">
</form>

You might also like