Get previous url in php and javascript

//code for index.php

<a href=”previous-url.php”>click for php</a>
<a href=”previous-url-javascript.php”>click for javascript</a>

//code for previous-url.php

echo $a=$_SERVER[‘HTTP_REFERER’];

//code for previous-url-javascript.php

<button onclick=”goBack()”>Go 2 pages back</button>

<p>Notice that clicking on the “Go 2 pages back” button here will not result in any action, because there is no previous URL in the history list.</p>

function goBack() {
window.history.go(-2);
}

Advertisements

Clock script in javascript

<script type=”text/javascript”>
tday  =new Array(“Sunday”,”Monday”,”Tuesday”,”Wednesday”,”Thursday”,”Friday”,”Saturday”);
tmonth=new Array(“January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,”September”,”October”,”November”,”December”);

function GetClock(){
d = new Date();
nday   = d.getDay();
nmonth = d.getMonth();
ndate  = d.getDate();
nyear = d.getYear();
nhour  = d.getHours();
nmin   = d.getMinutes();
nsec   = d.getSeconds();

if(nyear<1000) nyear=nyear+1900;

if(nhour ==  0) {ap = ” AM”;nhour = 12;}
else if(nhour <= 11) {ap = ” AM”;}
else if(nhour == 12) {ap = ” PM”;}
else if(nhour >= 13) {ap = ” PM”;nhour -= 12;}

if(nmin <= 9) {nmin = “0” +nmin;}
if(nsec <= 9) {nsec = “0” +nsec;}

document.getElementById(‘clockbox’).innerHTML=””+tday[nday]+”, “+tmonth[nmonth]+” “+ndate+”, “+nyear+” “+nhour+”:”+nmin+”:”+nsec+ap+””;
setTimeout(“GetClock()”, 1000);
}
window.onload=GetClock;
</script>

<div id=”clockbox”></div>

Allowed only Alphanumeric character

<script src=”js/jquery.js” type=”text/javascript”></script>
<script src=”js/jquery.validate.min.js” type=”text/javascript”></script>
<script type=”text/javascript”>
$(document).ready(function(){
$(“#mobilejj”).bind(‘keyup’, function(){
var TCode = document.test_form.mobilejj.value;
for(var i=0; i<TCode.length; i++)
{
var char1 = TCode.charAt(i);
var cc = char1.charCodeAt(0);
if((cc>47 && cc<58) || (cc>64 && cc<91) || (cc>96 && cc<123))
{
}
else
{
alert(‘Special character are not allowed\n\nPlease enter only alphanumeric’);
$(“#mobilejj”).val(”);
return false;
}
}
});
});
</script>

<form name=”test_form” id=”test_form” action=”” enctype=”multipart/form-data”>
<input type=”text” name=”mobilejj” id=”mobilejj” value=”” >
<input type=”text” name=”phonejj” id=”phonejj” value=””>
<input type=”submit” name=”test_send” id=”test_send” value=”Submit”>
</form>