- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
You can pass javascript values to HTML, tags by using an ID and Class of tags
<html>
<head>
<script type="text/javascript">
var i=0;
var fruits = new Array(5);
fruits[0] = "Apple";
fruits[1] = "Banana";
fruits[2] = "Mango";
fruits[3] = "Kiwi";
fruits[4] = "Guava";
function BtnClick()
{
if (i<= fruits.length-1)
{
document.getElementById("fruitsDiv").innerHTML += fruits[i] + '<br />';
i=i+1;
}else
{
if(confirm('do you want to see again ?'))
{
i=0;
document.getElementById("fruitsDiv").innerHTML='';
}
else
{
alert('Thanks!!');
}
}
}
</script>
</head>
<body>
<div id="fruitsDiv">
</div>
<input type='submit' onclick='javascript:BtnClick()' value='click' />
</body>
</html>
- Get link
- X
- Other Apps

Comments
Post a Comment