Member Avatar for chanderk

Hi,

I have the following piece of code.

<html>
<script language=javascript type='text/javascript'>
function Getlink(a, b)
{
    var targetURL="";
    switch(a)
    {
        case 'param1':       
            switch(b)
            {
                case 'param2':               
                    targetURL="http://www.google.com";                
                    break;
            }       
            break;
        default:
            break;
    }
    return targetURL;
}
</script>
<body>

<p>
  <!--<a href="javascript:Getlink('param1', 'param2')">Test google</a>-->
<a href="#" target="content" onClick="document.location.href=Getlink('param1', 'param2');">Test google</a> <a href="http://www.yahoo.com" target="content">Test yahoo</a> <a href="http://www.live.com" target="content">Test live </a></p>
<p>&nbsp;</p>
<table width="99%" height="246" border="0">
  <tr>
    <td><iframe name="content"></iframe>&nbsp;</td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>

When I click on Test yahoo and Test live I could able to display those sites in the iframe (content). But in case of test google, i wish to display in that iframe. But it always opens in new window. Could any one suggest me on this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.