Programs in JavaScript

5. Program to create a scrolling banner.
<html>
<head>
<style>
#divhead{
	background-color:gray;
	height:50px;
	width:150px;
	text-align:center;
	color:white;
	font-size:20;
}
</style>

<script>
function helpyou()
{
	tpos = document.body.scrollTop
	document.getElementById('divhead').style.position="absolute"
	document.getElementById('divhead').style.top=tpos+300
}
</script>

<body onscroll="helpyou()">
<div id="divcontainer">
	<div id="divhead">
	<p onclick='divcontainer.style.visibility="hidden"'>May I Help You</p>
	</div>
	Full page of content
</div>
</body>
</html>

Father of JavaScript


Brendan Eich

Brendan Eich

Born: 1961, Pennsylvania
Google+