Forum

> > Off Topic > Who knows HTML? I need a small code.
ForenübersichtOff Topic-ÜbersichtEinloggen, um zu antworten

Englisch Who knows HTML? I need a small code.

3 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Who knows HTML? I need a small code.

Xirot
User Off Offline

Zitieren
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.

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

Elfing
User Off Offline

Zitieren
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>
2× editiert, zuletzt 15.08.15 08:54:26

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

DC
Admin Off Offline

Zitieren
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.

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

Nekomata
User Off Offline

Zitieren
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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenOff Topic-ÜbersichtForenübersicht