FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Two links for one anchor?





phileplanet
Is there any way to accomplish this?
I'm using only html and php coding so far.
I heard there was a way to do this jsp but i'm not going to learn a new language just for this.

Can someone halp me?
Rafe
what do you mean by that? like the text "blah" leads to one page, or another?
maybe you can have a tool tip or some sort of cookie thing so if u click it if u have 1 preference it leads u to 1 page and other preference=other page. dunno much more then that.
SystemWisdom
Maybe you're looking for something like this:
Code:

<html>
<head>
<script language="JavaScript"><!--
function OpenWindows()
{
    for( var i = 0; i < arguments.length; i++ )
        window.open( arguments[i] );
}
//--></script>
</head>
<body>

<br /><a href="javascript:OpenWindows( 'http://www.msn.com' )">Open 1 Window</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com' )">Open 2 Windows</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com', 'http://www.microsoft.com' )">Open 3 Windows</a>

</body>
</html>


It can open more or less than 2 windows tho, so you could follow 2 or more links with 1 anchor..
phileplanet
SystemWisdom wrote:
Maybe you're looking for something like this:
Code:

<html>
<head>
<script language="JavaScript"><!--
function OpenWindows()
{
    for( var i = 0; i < arguments.length; i++ )
        window.open( arguments[i] );
}
//--></script>
</head>
<body>

<br /><a href="javascript:OpenWindows( 'http://www.msn.com' )">Open 1 Window</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com' )">Open 2 Windows</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com', 'http://www.microsoft.com' )">Open 3 Windows</a>

</body>
</html>


It can open more or less than 2 windows tho, so you could follow 2 or more links with 1 anchor..


Wow that did exactly what I wanted. Thank you so much!
I don't know anything about javascript so I just wanna know if there's anyway I can have one link open in a new window and one link open in the same window, all in one anchor.
Rafe
i guess i didnt really help. Embarassed
good to see u got it neways.
phileplanet
Rafe wrote:
i guess i didnt really help. Embarassed
good to see u got it neways.


Actually you could still help by answering my previous quote:)
BlackSkad
Code:
<script language="JavaScript">
<!--
function OpenWindows()
{
    for( var i = 0; i < arguments.length; i++ )
    {
        if (i == 0)
         window.location.href = arguments[i];
        else
         window.open( arguments[i] );
    }
}
//-->
</script>


I have added a simple control. This checks if it is the first link it encounters. If it is, the current window will change, if not, another window will pop-up.
So the page you want in the current window needs to be first.
phileplanet
BlackSkad wrote:
I have added a simple control. This checks if it is the first link it encounters. If it is, the current window will change, if not, another window will pop-up.
So the page you want in the current window needs to be first.


I think that would really help me but i'm not familiar with JavaScript so could you give me like an example in the html coding?

Let's say one window opens http://www.google.com/ and one opens http://www.hotmail.com/
BlackSkad
Code:

<html>
<head>
<script language="JavaScript"><!--
function OpenWindows()
{
    for( var i = 0; i < arguments.length; i++ )
    {
        if (i == 0)
         window.location.href = arguments[i];
        else
         window.open( arguments[i] );
    }
}
//--></script>
</head>
<body>

<br /><a href="javascript:OpenWindows( 'http://www.msn.com' )">Open 1 Window</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com' )">Open 2 Windows</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com', 'http://www.microsoft.com' )">Open 3 Windows</a>

</body>
</html>

The first link will open msn.com in the same window.
The second will open msn.com in the same window and hotmail.com in a new window.
The third one will open msn.com in the same window and hotmail.com and microsoft.com each in a new window.

Just place the one you want to open in the same window first.
phileplanet
BlackSkad wrote:
Code:

<html>
<head>
<script language="JavaScript"><!--
function OpenWindows()
{
    for( var i = 0; i < arguments.length; i++ )
    {
        if (i == 0)
         window.location.href = arguments[i];
        else
         window.open( arguments[i] );
    }
}
//--></script>
</head>
<body>

<br /><a href="javascript:OpenWindows( 'http://www.msn.com' )">Open 1 Window</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com' )">Open 2 Windows</a>
<br /><a href="javascript:OpenWindows( 'http://www.msn.com', 'http://www.hotmail.com', 'http://www.microsoft.com' )">Open 3 Windows</a>

</body>
</html>



Works perfectly. Thanks!
Related topics
Nokia has mp3 phone
Hot or Not PHP-Nuke script
managing a bilingual site
cosmic speed limit broken by researchers in switzerland
Java script
Font choice
How does it look
How to remove a bootscreen?
Longest domain name in the world!
My site for thoughts...
Is this site completely horrible, or is it just me?
links for html and dhtml.
Help Pleaseeeeeeeeeee!!!
Two Suggestions (edited for clarification)
This topic is locked: you cannot edit posts or make replies.    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.