This script will Calculate the percentage of increase/decrease between two units. A simple, effective script.Percentage Gain Javascript Calculator is very useful script.
DEMO:
Javascript Code: Live Clock on webpage,display current date and time on webpage free javascript code.
This is a cross browser live clock script. In this script you can configure every aspect , from specifying whether to just display the time, the time plus date, to the clock's font size/color, and more. The ultimate live clock script this is!
Step 1: Add the below code where you wish the clock to appear on the page:
This is a cross browser live clock script. In this script you can configure every aspect , from specifying whether to just display the time, the time plus date, to the clock's font size/color, and more. The ultimate live clock script this is!
Step 1: Add the below code where you wish the clock to appear on the page:
Step 2: On Tag onLoad event handler call the show_clock() javascript function:
<body onLoad="show_clock()">
Clock the visitor time visiting the page
If you want to display the total time a user spend on your webpage then the below javascript code is for you.
Button for printing the page, print the page button .
You can easily add a print button or link to your web page.
1-Add Print Button
The button looks like this:
2-Add Print This Link
The Print link looks like this: print This Page
You can easily add a print button or link to your web page.
1-Add Print Button
<form><input type="button"
value=" Print this page "
onclick="window.print();return false;" /></form>
onclick="window.print();return false;" /></form>
The button looks like this:
<a href="#"
onclick="window.print();return
false;">print</a>
The Print link looks like this: print This Page
So you would like to put a link on your page that will take visitor's back to the previous page and forward to next page. One that works just like the browser back and forward button.
Here is the button that does just that. Whatever page that you were on prior to coming to this page, the following button work browser back and forward button) will return you to it.
Here is the button that does just that. Whatever page that you were on prior to coming to this page, the following button work browser back and forward button) will return you to it.
This is a kind of useless piece of JavaScript code, although I suppose it could be useful for something. I will present you with the code straightaway, that will allow you to dynamically change the background color of the page.
The above code contains a dropdown menu.the background color will change as we change the selected value of dropdown menu.
The above code contains a dropdown menu.the background color will change as we change the selected value of dropdown menu.
In this tutorial, you will learn how to shake Internet Explorer window. I have already teach you about a JavaScript code from which you can shake your Mozilla Firefox window. You are gonna learn How to shake Internet Explorer window in this tutorial.
I have a javascript that causes the browser window to shake if someone clicks a button on the site to activate a function called shake().
This seems to work fine in Internet Explorer but it also causes the browser window to resize in Firefox.
you can also play with the numbers 10 and 1 in the script, you can change them to say 20 and 5 to get slightly different effects, but going to something like 50 or 100 could produce some scarey effects, don't know if i would trust such effects on my computer, javascript can get out of hand on a computer if mathmatics are not done right.
I have a javascript that causes the browser window to shake if someone clicks a button on the site to activate a function called shake().
This seems to work fine in Internet Explorer but it also causes the browser window to resize in Firefox.
you can also play with the numbers 10 and 1 in the script, you can change them to say 20 and 5 to get slightly different effects, but going to something like 50 or 100 could produce some scarey effects, don't know if i would trust such effects on my computer, javascript can get out of hand on a computer if mathmatics are not done right.
if you want to add a link or a button which if you click on it the page going to top you can have it and whenever the user click on the link the page goes again to the first of the page, the below javascript code will provide the same thing.
Simply Cut and Paste code snippet
Be sure to properly place script in body of html where link is to appear.
An increase in CTR can mean a lot to AdSense Revenue. To increase AdSense revenue, you have to either increase the traffic or CTR. If somehow, you manage to triple your CTR just by tweaking the Google AdSense code, you can get three times more traffic. Here are a few tips for increasing your CTR.
1-You should make your Adsense ads look as a part of your web page.
2-Text ads are better than image ads.
1-You should make your Adsense ads look as a part of your web page.
2-Text ads are better than image ads.
3-No Border ads.
4-No other advertisements.
5-Placement
Even if you have the best Ad, people will not respond if they don't see it instantly. The best place to see the ad is the top of your web page and the next is aside your document's text. Visitors will click it more frequently since it will look like your text.
6-Traffic
Try to use legitimate ways of traffic. Some people use Google Adwords and other Pay per Click search engines. The problem here is to search very carefully for the right niche and keywords in order to make your campaigns profitable.
7-Do not rely on one website
Yes you can make money with one website but try to make as more as possible.
8-Relevant content is King
9-Use site maps
Google's site maps visit your site and crawl it much sooner that any other submission process.
10-Relevant ads
It's one of the most important factors for Adsense success. If the internet user can't find relevant ad in your page he or she won't click the ad.
Disply calendar on your website
If you want to disply a calendar on your webpage then the below javascript code is for you,this code will display calendar on your webpage and it also highlight the current date.
Just copy paste the below code .
There are several ways of identifying a browser, but by using below JavaScript code you can Indentify Each and everything about browser.See the below example:
<html>
<body>
<script type="text/javascript">
var x =
navigator
document.write("CodeName="
+ x.appCodeName)
document.write("<br>")
document.write("MinorVersion="
+ x.appMinorVersion)
document.write("<br>")
document.write("Name="
+ x.appName)
document.write("<br>")
document.write("Version="
+ x.appVersion)
document.write("<br>")
document.write("CookieEnabled="
+ x.cookieEnabled)
document.write("<br>")
document.write("CPUClass="
+ x.cpuClass)
document.write("<br>")
document.write("OnLine="
+ x.onLine)
document.write("<br>")
document.write("Platform="
+ x.platform)
document.write("<br>")
document.write("UA="
+ x.userAgent)
document.write("<br>")
document.write("BrowserLanguage="
+ x.browserLanguage)
document.write("<br>")
document.write("SystemLanguage="
+ x.systemLanguage)
document.write("<br>")
document.write("UserLanguage="
+ x.userLanguage)
</script>
</body>
</html>
There are several ways of identifying a browser, but by using below JavaScript code you can Indentify your browser.
<html>
<body>
<h1>Welcome Guest !</h1>
<hr>
<p>Your browser identifies as:<br>
<script language="JavaScript" type="text/javascript">
document.write(navigator.userAgent + ".");
</script>
</p>
</body>
</html>
You can get More details about the client's browser See the below Example:
<html>
<body>
<script type="text/javascript">
document.write("<p>Browser:
")
document.write(navigator.appName + "</p>")
document.write("<p>Browserversion:
")
document.write(navigator.appVersion + "</p>")
document.write("<p>Code:
")
document.write(navigator.appCodeName + "</p>")
document.write("<p>Platform:
")
document.write(navigator.platform + "</p>")
document.write("<p>Cookies
enabled: ")
document.write(navigator.cookieEnabled + "</p>")
document.write("<p>Browser's
user agent header: ")
document.write(navigator.userAgent + "</p>")
</script>
</body>
</html>
Handling onBlur and onFocus in Frames
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function gotFocus()
{
document.bgColor="#FFFFFF"
}
function
lostFocus() {
document.bgColor="#FF0000";
}
</SCRIPT>
</HEAD>
<BODY onFocus="gotFocus()" onBlur="lostFocus()">
<H1>Document 1</H1>
</BODY>
</HTML>
IE4+ Event Coordinate Properties
<HTML>
<HEAD>
<TITLE>X and Y Event Properties (IE4+)</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function
checkCoords() {
var form =
document.forms[0]
form.srcElemTag.value = "<" + event.srcElement.tagName
+ ">"
form.clientCoords.value = event.clientX + ","
+ event.clientY
form.pageCoords.value = (event.clientX + document.body.scrollLeft) +
","
+ (event.clientY + document.body.scrollTop)
form.offsetCoords.value = event.offsetX + ","
+ event.offsetY
form.screenCoords.value = event.screenX + ","
+ event.screenY
form.xyCoords.value = event.x + ","
+ event.y
form.parElem.value = "<" + event.srcElement.offsetParent.tagName
+ ">"
return false
}
function
handleSize() {
document.forms[0].resizeCoords.value = event.clientX + ","
+ event.clientY
}
</SCRIPT>
</HEAD>
<BODY onMouseDown="checkCoords()" onResize="handleSize()">
<H1>X and Y Event Properties (IE4+)</H1>
<HR>
<P>Click on the button and in the
DIV/image to see the coordinate values for the
event object.</P>
<FORM NAME="output">
<TABLE>
<TR><TD COLSPAN=2>IE Mouse
Event Coordinates:</TD></TR>
<TR><TD ALIGN="right">srcElement:</TD><TD><INPUT TYPE="text" NAME="srcElemTag"
SIZE=10></TD></TR>
<TR><TD ALIGN="right">clientX,
clientY:</TD><TD><INPUT TYPE="text"
NAME="clientCoords" SIZE=10></TD>
<TD ALIGN="right">...With
scrolling:</TD><TD><INPUT TYPE="text"
NAME="pageCoords" SIZE=10></TD></TR>
<TR><TD ALIGN="right">offsetX,
offsetY:</TD><TD><INPUT TYPE="text"
NAME="offsetCoords" SIZE=10></TD></TR>
<TR><TD ALIGN="right">screenX,
screenY:</TD><TD><INPUT TYPE="text"
NAME="screenCoords" SIZE=10></TD></TR>
<TR><TD ALIGN="right">x,
y:</TD><TD><INPUT TYPE="text" NAME="xyCoords"
SIZE=10></TD>
<TD ALIGN="right">...Relative
to:</TD><TD><INPUT TYPE="text" NAME="parElem"
SIZE=10></TD></TR>
<TR><TD ALIGN="right"><INPUT TYPE="button" VALUE="Click Here"></TD></TR>
<TR><TD COLSPAN=2><HR></TD></TR>
<TR><TD COLSPAN=2>Window
Resize Coordinates:</TD></TR>
<TR><TD ALIGN="right">clientX,
clientY:</TD><TD><INPUT TYPE="text"
NAME="resizeCoords" SIZE=10></TD></TR>
</TABLE>
</FORM>
<DIV ID="display"
STYLE="position:relative;
left:100">
<IMG SRC="nile.gif"
WIDTH=320 HEIGHT=240" BORDER=0>
</DIV>
</BODY>
</HTML>
Using the srcElement property
<HTML>
<HEAD>
<TITLE>srcElement Property</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function
highlight() {
var elem = event.srcElement
if
(elem.className == "bold") {
document.styleSheets[0].rules[0].style.color = "red"
} else {
elem.style.color = "#FFCC00"
}
}
function restore()
{
var elem = event.srcElement
if
(elem.className == "bold") {
document.styleSheets[0].rules[0].style.color = "yellow"
} else {
elem.style.color = "red"
}
}
</SCRIPT>
<STYLE TYPE="text/css">
.bold {font-weight:bold}
</STYLE>
</HEAD>
<BODY onMouseDown="highlight()" onMouseUp="restore()">
<H1>srcElement Property</H1>
<HR>
<P>One event handler...</P>
<UL>
<LI>A
<LI>BB
<LI>CCC
<LI>DDDD
</UL>
<P>
Text Text <span class="bold">Text</span> Text Text Text Text
</P>
</BODY>
</HTML>
Event Bubbling Demonstration
<HTML onClick="alert('Event is now at the HTML element.')">
<HEAD>
<TITLE>Event Bubbles</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function init() {
window.onclick = winEvent
document.onclick = docEvent
document.body.onclick = docBodEvent
}
function winEvent()
{
alert("Event
is now at the window object level.")
}
function docEvent()
{
alert("Event
is now at the document object level.")
}
function
docBodEvent() {
alert("Event
is now at the BODY element.")
}
</SCRIPT>
</HEAD>
<BODY onLoad="init()">
<H1>Event Bubbles</H1>
<HR>
<FORM onClick="alert('Event is now at the FORM element.')">
<INPUT TYPE="button"
VALUE="Button
'main1'" NAME="main1"
onClick="alert('Event started at Button: ' +
this.name)">
</FORM>
</BODY>
</HTML>