Hi people, could i havew a base code so if i left or right mouse click inside a cell it pops up a webpage?
Hi people, could i havew a base code so if i left or right mouse click inside a cell it pops up a webpage?
This will often be blocked (security and usability settings in modern browsers), especially for the right click, but here it is:
You will probably have slightly more compliance in browsers if you do it like so:HTML Code:<td onclick="window.open('some.htm','_blank');"> Whatever </td>
HTML Code:<td> <a href="some.htm" onclick="window.open(this.href,'_blank');return false;" style="display:block;width:100%;height:100%;">Whatever</a> </td>
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
You could just use<a href="..." style="..." target="_blank">...</a>instead of. Plus, it is reccommended that you don't use events in attributes such asHTML Code:<a href="..." onclick="window.open(this.href,'_blank');return false;" style="...">...</a><button onclick="...">...</button>.
Hmm, I'm not too big on what is 'recommended' without an explanation as to why it is recommended.
Regardless of whether it's done my way or your way, I don't recommend doing this at all (due to its often being blocked in the manner I already outlined in my first post in this thread).
Unless it isn't all that important that it happen -in other words the site would work fine if the page opens in the same window/tab, another window/tab, or not at all - all possibilities for any given user with any attempt like this. I would also note that your use of the target attribute is deprecated (meaning that future support is questionable), so at lest in that sense is not recommended.
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Bookmarks