ManyCodes.com – codes & scripts Get free programming codes and tutorials!

29Jul/090

How to show/embed music and video (Mid, Mp3, Wma, Wmv) on your webpage

Here is how you can show/embed music and video (Mid, Mp3, Wma, Wmv) on your webpage. Remember to replace the

http://kkrcity.com/1.mp3

with the video or audio you want the media player to play on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<embed "1" TYPE="application/x-mplayer2" SRC="http://kkrcity.com/1.mp3" autostart="true" WIDTH="120" HEIGHT="50"></embed>
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
29Jul/090

How to show the number of visitors online on your website

Here is how you can show the number of visitors online on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<!-- Start FastOnlineUsers.com -->
Oneline users :
<script src=http://fastonlineusers.com/online.php?d=www.YOUR WEB  NAME.com> </script>
<!-- End FastOnlineUsers.com -->
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
29Jul/090

How to show the various time zones of the world on your website

Here is how you can show the various time zones of the world on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<table border="0" width="200" cellspacing="0" cellpadding="3">
<form name="where">
 <tr>
 <td width="100%">
<select name="city" size="1" onchange="updateclock(this);">
<option value="" selected>Local time</option>
<option value="0">London GMT</option>
<option value="1">Rome</option>
<option value="7">Bangkok</option>
<option value="8">Hong Kong</option>
<option value="9">Tokyo</option>
<option value="10">Sydney</option>
<option value="12">Fiji</option>
<option value="-10">Hawaii</option>
<option value="-8">San Francisco</option>
<option value="-5">New York</option>
<option value="-3">Buenos Aires</option>
</select>

</td>
 </tr>
 <tr>
 <td width="100%">
<script language="JavaScript">

/*
Drop Down World Clock- By Learn iran (http://www.webloger.5u.com)
Portions of code by Kurt @ http://www.webloger.5u.com/
This credit notice must stay intact
*/

if (document.all||document.getElementById)
document.write('<span id="worldclock" style="font:bold 16px Arial;"></span><br>')

zone=0;
isitlocal=true;
ampm='';

function updateclock(z){
zone=z.options[z.selectedIndex].value;
isitlocal=(z.options[0].selected)?true:false;
}

function WorldClock(){
now=new Date();
ofst=now.getTimezoneOffset()/60;
secs=now.getSeconds();
sec=-1.57+Math.PI*secs/30;
mins=now.getMinutes();
min=-1.57+Math.PI*mins/30;
hr=(isitlocal)?now.getHours():(now.getHours() + parseInt(ofst)) + parseInt(zone);
hrs=-1.575+Math.PI*hr/6+Math.PI*parseInt(now.getMinutes())/360;
if (hr < 0) hr+=24;
if (hr > 23) hr-=24;
ampm = (hr > 11)?"PM":"AM";
statusampm = ampm.toLowerCase();

hr2 = hr;
if (hr2 == 0) hr2=12;
(hr2 < 13)?hr2:hr2 %= 12;
if (hr2<10) hr2="0"+hr2

var finaltime=hr2+':'+((mins < 10)?"0"+mins:mins)+':'+((secs < 10)?"0"+secs:secs)+' '+statusampm;
if (document.all)
worldclock.innerHTML=finaltime
else if (document.getElementById)
document.getElementById("worldclock").innerHTML=finaltime
else if (document.layers){
document.worldclockns.document.worldclockns2.document.write(finaltime)
document.worldclockns.document.worldclockns2.document.close()
}


setTimeout('WorldClock()',1000);
}

window.onload=WorldClock
//-->
</script>

<!--Place holder for NS4 only-->
<ilayer id="worldclockns" width=100% height=35><layer id="worldclockns2" width=100% height=35 left=0 top=0 style="font:bold 16px Arial;"></layer></ilayer>

</td>
</form>
 </tr>
</table>
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
29Jul/090

How to show an alert by click (msg box) on your website

Here is how you can show an alert by click (msg box) on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com --><!-- Start of Message Alert -->
<!-- Use this button in a form to pop-up a message when the user clicks it -->
<form>
<input type="button" value="message" onClick="alert('YOUR MESSAGE GOES HERE'); return true">
</form>
<!-- End of Message Alert -->
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
28Jul/090

How to have a slide show showing pictures on your website

Here is how you can have a slide show showing pictures on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->
<!-- Drop Down Image Preview


 1.  Copy the coding into the HEAD of your HTML document
 2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
function CoffeePreview(sel) {
document.CoffeePreview.src = "" + sel.options[sel.selectedIndex].value;
}
function CoffeeShow(sel) {
images = new Array();
images[1] = "1.jpg";
images[2] = "2.jpg";
images[3] = "3.jpg";
images[4] = "4.jpg";
images[5] = "5.jpg";
images[6] = "6.jpg";
window.location.href = images[sel.selectedIndex+1];
}
//  End -->
</script>
</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<center>
<form name=previewselect>
<select name=selbox size=1 onChange="CoffeePreview(this)">
<option value="1-small.jpg">Image #1
<option value="2-small.jpg">Image #2
<option value="3-small.jpg">Image #3
<option value="4-small.jpg">Image #4
<option value="5-small.jpg">Image #5
<option value="6-small.jpg">Image #6
</select>
<p>
<img name="preview" src="1-small.jpg" width=150 height=113 border=1>
<p>
<input type=button value="view Image" onclick="CoffeeShow(this.form.selbox)">
</form>
</center>

<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
28Jul/090

How to show today’s Date on your website

Here is how you can show today's Date on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<!-- this script is from www.manycodes.com -->

<!-- ONE STEP TO INSTALL MONTHLY:  DAY HIGHLIGHTED:

 1.  Put the code into the BODY of your HTML document  -->
<!-- STEP ONE: Copy this code into the HEAD your HTML document  -->
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>

<body>

<center>
<script LANGUAGE="JavaScript">

<!-- Begin
monthnames = new Array(
"January",
"Februrary",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"Decemeber");
var linkcount=0;
function addlink(month, day, href) {
var entry = new Array(3);
entry[0] = month;
entry[1] = day;
entry[2] = href;
this[linkcount++] = entry;
}
Array.prototype.addlink = addlink;
linkdays = new Array();
monthdays = new Array(12);
monthdays[0]=31;
monthdays[1]=28;
monthdays[2]=31;
monthdays[3]=30;
monthdays[4]=31;
monthdays[5]=30;
monthdays[6]=31;
monthdays[7]=31;
monthdays[8]=30;
monthdays[9]=31;
monthdays[10]=30;
monthdays[11]=31;
todayDate=new Date();
thisday=todayDate.getDay();
thismonth=todayDate.getMonth();
thisdate=todayDate.getDate();
thisyear=todayDate.getYear();
thisyear = thisyear % 100;
thisyear = ((thisyear < 50) ? (2000 + thisyear) : (1900 + thisyear));
if (((thisyear % 4 == 0)
&& !(thisyear % 100 == 0))
||(thisyear % 400 == 0)) monthdays[1]++;
startspaces=thisdate;
while (startspaces > 7) startspaces-=7;
startspaces = thisday - startspaces + 1;
if (startspaces < 0) startspaces+=7;
document.write("<table border=2 bgcolor=white ");
document.write("bordercolor=black><font color=black>");
document.write("<tr><td colspan=7><center><strong>"
+ monthnames[thismonth] + " " + thisyear
+ "</strong></center></font></td></tr>");
document.write("<tr>");
document.write("<td align=center>Su</td>");
document.write("<td align=center>M</td>");
document.write("<td align=center>Tu</td>");
document.write("<td align=center>W</td>");
document.write("<td align=center>Th</td>");
document.write("<td align=center>F</td>");
document.write("<td align=center>Sa</td>");
document.write("</tr>");
document.write("<tr>");
for (s=0;s<startspaces;s++) {
document.write("<td> </td>");
}
count=1;
while (count <= monthdays[thismonth]) {
for (b = startspaces;b<7;b++) {
linktrue=false;
document.write("<td>");
for (c=0;c<linkdays.length;c++) {
if (linkdays != null) {
if ((linkdays[0]==thismonth + 1) && (linkdays[1]==count)) {
document.write("<a href=\"" + linkdays[2] + "\">");
linktrue=true;
 }
 }
}
if (count==thisdate) {
document.write("<font color='FF0000'><strong>");
}
if (count <= monthdays[thismonth]) {
document.write(count);
}
else {
document.write(" ");
}
if (count==thisdate) {
document.write("</strong></font>");
}
if (linktrue)
document.write("</a>");
document.write("</td>");
count++;
}
document.write("</tr>");
document.write("<tr>");
startspaces=0;
}
document.write("</table></p>");
// End -->
</script>
</center>
<!-- Script Size:  2.98 KB  -->

</body>

</html>
<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>
28Jul/090

How to show how many visitors are online on your website

Here is how you can show how many visitors are online on your website.

Put the code below within your site's source code. If you dont know how to implement this code into your site, please goto how to implement the code to your website

Code:

<pre><!-- this script is from www.manycodes.com --></pre>
<script src=http://fastonlineusers.com/online.php?d=www.mohager.co.sr></script>

<font face="Tahoma"><a target="_blank" href="http://www.manycodes.com/category/java/javascript-codes/"><span style="font-size: 8pt; text-decoration: none">JavaScript Free Code</span></a></font>