开发者

Creating a link for a div

开发者 https://www.devze.com 2023-03-30 01:58 出处:网络
I have a logo in a div and would like to have it link to a home page on click. From my quick search it looks like this could easily be done with css stylesheets. Any other quic开发者_开发问答k way to

I have a logo in a div and would like to have it link to a home page on click. From my quick search it looks like this could easily be done with css stylesheets. Any other quic开发者_开发问答k way to do it with javascript or jquery or something??


You can't do this with CSS. You need to use actual markup for the link, and using Javascript with onClick and window.location would just be stupid.

<a href="http://www.myhomepage.com" title="CLick to go to Home">
 <img src="/images/logo.png" height=64 width=32 alt="logo" />
</a>


just wrap the image file in an anchor tag? If you are not using an image tag to display the logo, you can use javascript/jquery to leverage the click event of the div to navigate to the link.


Use this:

onClick="parent.location='page.html'
0

精彩评论

暂无评论...
验证码 换一张
取 消