Professional Documents
Culture Documents
HTML
HTML
<body>
<form name="myform">
</form>
</body>
<script>
with(document.forms.myform)
function fun()
//var all=document.getElementById("txt");
if(a.checked==true)
txt.value+=ab+"Apple";
if(b.checked==true)
txt.value+=ab+"banana";
}
if(c.checked==true)
txt.value+=ab+"mango";
if(d.checked==true)
txt.value+=ab+"orange";
</script>
</html>
<html>
<body>
<option value="Mumbai">Mumbai</option>
<option value="Delhi">Delhi</option>
<option value="Bangaluru">Bangaluru</option>
</select>
<br>
<br>
<table border="2">
<tr>
<th>
City Name:
</th>
<th>
Discription:
</th>
<th>
Image:
</th>
</tr>
<tr>
<td>
<p id="demo"></p>
</td>
<td>
<p id="des"></p>
</td>
<td>
</td>
</tr>
</table>
<script>
function fun(val){
document.getElementById("demo").innerHTML=val;
if(val=='Mumbai')
document.getElementById("des").innerHTML="This is mumbai";
document.image.src="orange.jpg"
if(val=='Delhi')
{
document.getElementById("des").innerHTML="This is delhi";
document.image.src="Mango.jpg"
if(val=='Bangaluru')
document.getElementById("des").innerHTML="This is Bangaluru";
document.image.src="apple.jpg"
</script>
</body>
</html>
<html>
<body id="bg">
<form name="myform">
</form>
</body>
<script>
with(document.forms.myform){
function fun(val)
if(val=="Red"){
clk.value="Blue"
document.getElementById("bg").style.background=val;
}
if(val=="Blue"){
clk.value="Red"
document.getElementById("bg").style.background=val;
// if(clk.value=="Red"){
// clk.value="Blue"
// //bg.style.background=val;
// }
// if(clk.value=="Blue"){
// clk.value="Red"
// }
</script>
</html>
<html>
<body>
<table border="2">
<tr>
<td>
<ul>
<li>
<a
onmouseover="javascript:document.getElementById('main').innerHTML='Discount is=80%'">
<h2>Mrutunjay</h2>
</a>
</li>
<li>
<a
onmouseover="javascript:document.getElementById('main').innerHTML='Discount is=70%'">
<h2>Mrutunjay</h2>
</a>
</li>
<li>
<a
onmouseover="javascript:document.getElementById('main').innerHTML='Discount is=60%'">
<h2>Mrutunjay</h2>
</a>
</li>
</ul>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
<html>
<body>
<table border="2">
<tr>
<td>
Name:
</td>
<td>
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
</td>
</tr>
<tr>
<td>
Pin code:
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
<button onclick="Validate()">Submit</button>
</td>
</tr>
</table>
<script>
function Validate(){
var regex=/^\d{6}$/;
var n=document.getElementById("name").value
var e=document.getElementById("email").value
var p=document.getElementById("pin").value
p=parseInt(p);
else{
if(regex.test(p)){
else{
</script>
</body>
</html>
<html>
<body>
Username:
<br><br>
Password:
<br><br>
<script>
var arr=[['user1','pass1'],['user2','pass2'],['user3','pass3']];
function check()
var u=document.getElementById("user").value;
var p=document.getElementById("pass").value;
switch(u){
case arr[0][0]:
if(p==arr[0][1])
alert("Login")
else{
alert("login unsuccessfully");
break;
case arr[1][0]:
if(p==arr[1][1])
alert("Login")
else{
alert("login unsuccessfully");
break;
case arr[2][0]:
if(p==arr[2][1])
alert("Login")
else{
alert("login unsuccessfully");
}
break;
default:
alert("login unsuccessfully");
</script>
</body>
</html>
<html>
<body>
<script>
var arr=[1,4,3,2,1,4,2,1]
var res=0;
for(var i=0;i<arr.length;i++){
for(var j=0;j<arr.length;j++){
if(i!==j){
if(uni[i]==arr[j]){
res+=1;
alert("count="+res)
</script>
</body>
</html>