adredz Posted January 10, 2010 Share Posted January 10, 2010 i have a div that has a onclick attribute. the problem is i can't right-click(to open to a new tab) on it and it won't display the target link on the browser's status bar. i know i can insert a <a> tag, but it requires a text for the link and it would make things complicated for me since i already have the background image of my div marked with text. any help? Quote Link to comment Share on other sites More sharing options...
haku Posted January 10, 2010 Share Posted January 10, 2010 It's bad practice to use javascript for opening links, as users without javascript turned on will not be able to use the link. Change the div to an <a> tag, and apply your background to that. It will fix all your problems, including the ones you didn't realize you have. Quote Link to comment Share on other sites More sharing options...
bombsquad Posted January 28, 2010 Share Posted January 28, 2010 that's right avoid using javascript. Quote Link to comment Share on other sites More sharing options...
oni-kun Posted January 29, 2010 Share Posted January 29, 2010 i have a div that has a onclick attribute. the problem is i can't right-click(to open to a new tab) on it and it won't display the target link on the browser's status bar. i know i can insert a <a> tag, but it requires a text for the link and it would make things complicated for me since i already have the background image of my div marked with text. any help? You can wrap the div in an ancher tag, this would allow it to be clicked, and rightclicked accordingly (as long as it's in the div itself and not in interelements) Quote Link to comment Share on other sites More sharing options...
lostprophetpunk Posted January 29, 2010 Share Posted January 29, 2010 You could also make the links within that div display as a block that is the width and height of your div. Quote Link to comment Share on other sites More sharing options...
haku Posted January 29, 2010 Share Posted January 29, 2010 This method is invalid, as you are not allowed to have divs inside a tags. But you can do this: <div> <a>jfkdla</a> </div> CSS: div a { height:100%; width:100%; display:block; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.