Forum

> > Off Topic > Who knows HTML? I need a small code.
Forums overviewOff Topic overviewLog in to reply

English Who knows HTML? I need a small code.

3 replies
To the start Previous 1 Next To the start

old Who knows HTML? I need a small code.

Xirot
User Off Offline

Quote
I'm plainning to make a colorated text like "Click here" which redirects to two links.
The first in the same window and the second in a new window.

Thank you for advancing.

old Re: Who knows HTML? I need a small code.

Elfing
User Off Offline

Quote
Would this do?

1
2
3
4
5
6
7
8
<!DOCTYPE html>
<html>
<body>

<a href="http://www..net" target="_blank">Hi</a>    <---Opens in a new tab
<a href="http://www..com">Hi</a>    <---same window
</body>
</html>

If you meant in one hyperlink;

1
2
3
4
5
6
7
<!DOCTYPE html>
<html>
<body>
<a href="http://google.com" onclick="window.open('http://fwsserver.forumotions.net');
return true;">Click Here</a>
</body>
</html>
edited 2×, last 15.08.15 08:54:26 am

old Re: Who knows HTML? I need a small code.

DC
Admin Off Offline

Quote
Opening two pages with one link and also opening stuff in new windows is considered bad style and you really shouldn't do it. It might even be blocked by some browsers / ad blockers!

Just think about it that way: When you're browsing a website, would you like links to open a new window AND go to another page in the current window? That behavior is not expected and therefore it is confusing and annoying.

old Re: Who knows HTML? I need a small code.

Nekomata
User Off Offline

Quote
As DC said, it's possible using javascript yet it's a really bad practice. Consider it taboo.

This is how you can colorize the text using html without any css stylesheet.
1
<a href="#" style="color:#ff0000;">Link</a>
You can replace the color value with any rgb/rgba/hex code as well.

And the rest as to opening in another tab is explained by Elfing.

And just so you don't get confused, this is necessary HTML5 validity material. All you need is the a tag.
1
2
3
4
5
6
<!DOCTYPE html>
<html>
<body>

</body>
</html>

You can understand more here and here.
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview