Posts Tagged “location.href”

We have all run into the issue of having a background image as our site header but then you want to link the header to hoe page – so what do you do? You could bring the image out from the background or make an empty space into a link or you can use this handy code to make the entire <DIV> a link:

<div onclick=”location.href=’http://www.yourdomain.com’;” style=”cursor: pointer;”>

The Javascript Onclick Event can be used on all of these html tags:
<a>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>, <button>, <caption>, <cite>, <code>, <dd>, <dfn>, <div>, <dl>, <dt>, <em>, <fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <img>, <input>, <kbd>, <label>, <legend>, <li>, <map>, <object>, <ol>, <p>, <pre>, <samp>, <select>, <small>, <span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>, <th>, <thead>, <tr>, <tt>, <ul>, <var>

It can also be used in conjunction with any of these Javascript objects:
button, document, checkbox, link, radio, reset, submit

Comments 1 Comment »