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 [...]
Ever wondered how to create a bookmark feature for your website? This is how to do it. This code only works in IE. It will display a message to other browsers showing them how to bookmark.
Source Code
<script LANGUAGE=”Javascript”>
<!– Begin
if ((navigator.appName == “Microsoft Internet Explorer”) && (parseInt(navigator.appVersion) >= 4)) {
var url=”http://www.snidge.com”;
var title=”Web Design & Development”;
document.write(’<A HREF=”javascript:window.ext’);
document.write(’ernal.AddFavorite(url,title);” [...]
Wondering how to make a simple javascript navigation back link to place on your website? This code will take the user -1 in the browser history. You can change the value to whatever you would like.
Use it as a link:
<a href=”#” onClick=”history.go(-1)”>Back</a>
Use it as a button:
<input type=button value=”Back” onClick=”history.go(-1)”>