views:

30

answers:

1

I have an html page. Here, I am using tabview of Yahoo API. That is :

<div id="demo" class="yui-navset">
    <ul class="yui-nav">
        <li class="selected"><a href="#tab1" onclick="TopStories()"><em>Top Stories</em></a></li>
        <li><a href="#tab2" onclick="FinanceNews()"><em>Finance</em></a></li>
        <li><a href="#tab3" onclick="SportsNews()"><em>Sports</em></a></li>
    </ul>            
    <div class="yui-content">
        <div><p>Top Stories</p></div>
        <div><p>Finance</p></div>
        <div><p>Sports</p></div>
    </div>
</div>

In the onClickEvent the functions used, fetch data from Google NEWS>

function TopStories(){
location.href="http://www.google.com/news/search?aq=f&amp;pz=1&amp;cf=all&amp;ned=in&amp;hl=en&amp;q=TopStories";
}
function FinanceNews(){
location.href="http://www.google.com/news/search?aq=f&amp;pz=1&amp;cf=all&amp;ned=in&amp;hl=en&amp;q=Finance";
}
function SportsNews(){
location.href="http://www.google.com/news/search?aq=f&amp;pz=1&amp;cf=all&amp;ned=in&amp;hl=en&amp;q=Sports";
}

But the Output is navigation to NEWS page. But, I want to display them as Tab Content.

What should I do ?

A: 

You can use iframe for this purpose .. see below example ,,

Using Jquery tab, its always create a div where your result display. You have only way to open external link on your page using .

<li><a href=ReturnIfram()><span>Google</span></a></li>

href get a string which contain ifram like

public string ReturnIfram()
{
   return "<iframe src="http://google.fr"&gt;&lt;/iframe&gt;"
}

try above in javascript see below example

<html>
<head>
<script language="JavaScript" type="text/javascript">
function makeFrame() {
   ifrm = document.createElement("IFRAME");
   ifrm.setAttribute("src", "http://developerfusion.com/");
   ifrm.style.width = 640+"px";
   ifrm.style.height = 480+"px";
   document.body.appendChild(ifrm);
}
</script>
</head>
<body>
<p><a href="#" onMouseDown="makeFrame()">GO! </a></p>
</body>
</html> 
Amit
Sarang
see above example to do it in javascript... change above according to ur requirement.
Amit