To redirect to a new page, or to reload the one you’re on without using Javascript, you’re going to want to use the following code.
Today I’m going to show you how to setup a javascript refresh function that can be called whenever you would like to refresh the page. This code can also work as a redirect script.
Lets start with the function…
<script type=”text/javascript”>
function pageRefresh(timeoutPeriod) {
setTimeout(”location.reload(true);”,timeoutPeriod);
}
</script>
Now lets look at the call for this function. This is how you would [...]
Today I’m going to show you how to make a <div> = the contents of a javascript variable. It’s actually very simple to do!
First lets start with the <div>
<div id=”thediv”></div>
Now lets do the javascript. Areas you will need to change are in bold.
<script type=”text/javascript”>
var thevar = “This is a test“;
document.getElementById(’thediv‘).innerHTML = thevar;
</script>
That will make the [...]
This ones pretty simple. If you’ve ever wanted to make sure you get a real e-mail address through your input forms, a good way to check an address is by using the following e-mail validation.
if (!eregi(”^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $email)) {
//code here
}
This code will check to make sure that the variable “$email” is in an e-mail format. [...]