0

I need to make all site clickable. I tried to make ahref before content div but it works only in Firefox&Chrome not in IE. So I made site as a clickable table like this:

 <table onclick="window.location='http://google.pl'" id="Table_01"> ...here goes content...

It's working in Chrome, FireFox and IE ....but... I am wondering if it is right method and it will be working on every computer?

5
  • Why don't you just use nested <a> tags? Feb 23, 2015 at 11:25
  • Possible duplicate: stackoverflow.com/questions/4182487/…
    – Moduo
    Feb 23, 2015 at 11:27
  • 1
    because <a> tags outside a block tag like table didn't work in IE
    – Tony
    Feb 23, 2015 at 11:32
  • @Adam which version of IE are you using? Feb 23, 2015 at 11:38
  • @VivecVelothian I use IE 8
    – Tony
    Feb 23, 2015 at 11:50

1 Answer 1

1

According html5 spec, you can use link tag outside a block tag like table:

<a href="http://google.pl">
    <table></table>
</a>

Dont forget to apply display: block to link.

If you dont want to use link tag, you should write your script on js file and not usinf onclick property using id for example:

<table id="Table_01">

js:

function redirect() {
    window.location = 'http://google.pl';
}
document.getElementById("Table_01").onclick = redirect;
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.