开发者

Can jQuery UI Tabs load new complete HTML pages?

I created an index.html page that have 3 different tabs. With the function tabs() of jQuery UI I want to load an html page with Ajax. Every HTML page use jQuery library, so every page have this code:

<link type="text/css" href="css/redmond/jquery-ui-1开发者_JS百科.8.5.custom.css" rel="stylesheet" /> <script type="text/javascript" src="js/jquery-1.4.3.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.5.custom.min.js"></script>

If I click on a tab the page is loaded but the JavaScript function of the page doesn't work!

So can I load in a tab a new complete HTML page (HTML+JS)?


two possibilities:

1) if you need jquery-ui in each tab, it's better to load it when initalizing your tabs.

2) use following to load your javascript files:

$.getScript("js/jquery-ui-1.8.5.custom.min.js");
and for css:
$.get("css/redmond/jquery-ui-1.8.5.custom.css", function(css) {
$("head").append(""+css+"");
}); 

Edit: You never load a complete new html page with ajax tabs - you only load a code snippet which is included in your existing html page. Use Firebug for Mozilla Firefox to see what happens ;o)


Ok, the problem is to understand what the tabs do. With Ajax I can load some content in a tab. If I declare a <div> for a tab, Ajax loads the content in that <div> so I can't load a new complete HTML page becouse the DOM after the load have two open <html><head> ecc.

So now I understand the function of the Ajax in the tab, and the load of complete HTML page is a big mistake!

Thanks Tobias.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜