DEV Community

safejourney-art
safejourney-art

Posted on

Let's make a link!

Hello!
Have you ever made a link? Yes, maybe the answer is yes. Unless your website is a single page application, a link would be there.
Well, how do you make a link?
The answer is, use an anchor tag like

<a>Link</a>

Another question is here. Have you ever imagined the whole background is a link?
JavaScript can make it real.
More generally, JavaScript can make a link anywhere you want!
The magic word is "onclick." If you write it inside the body element, you can make the whole background a link. The code which realises it is for example (onclick="link()"):

function link(){
   location.href = "url or path";
}

body, div, button, even anchor, anywhere can be made a link!
Sure that you are getting closer to your beautiful imaginations.
Safe journey!

I almost forgot. There is one more thing.
For you, I have created a JavaScript website. Many things JavaScript can draw are there.

Top comments (1)

Collapse
 
safejourneyart profile image
safejourney-art

Thanks for your comment!
Yes, UX is important:D