Web_Designer
Web_Designer

Reputation: 74550

Javascript onclick div element load page similar to link

How do I load another page on the onClick event in Javascript?

<div id="div_man" onclick="/subfolder/index.htm"></div>

The code above is not working. Please explain. I am sure it's quite simple. Thanks in advance!

Upvotes: 11

Views: 43432

Answers (1)

ArtBIT
ArtBIT

Reputation: 3999

<div id="div_man" onclick="location.href='/subfolder/index.htm'"></div>

Here's a working example: http://jsfiddle.net/ArtBIT/EEjyP/

Upvotes: 20

Related Questions