Not sure what you are trying to do but from the look of it I think you are trying to have one div visible and the other not, then switching when the other tab link is clicked? if that is what your after the below code works well but requires jquery.
HTML Code:
<html><head><!-- include jquery library from wherever you like --><script type="text/javascript" src="/js/jquery.js"></script><!-- this script runs the whole shebang --><script type="text/javascript">
function showonlyone(thechosenone) {
$('div[title|="tabs"]').each(function(index) {
if ($(this).attr("id") == thechosenone) {
$(this).show(0);
}
else {
$(this).hide(0);
}
});
}
</script></head><body><!-- these links select the tab to display --><a id="tablink1" onclick="javascript:showonlyone('tabs1')">Show First Tab</a><a id="tablink2" onclick="javascript:showonlyone('tabs2')">Show Second Tab</a><a id="tablink3" onclick="javascript:showonlyone('tabs3')">Show Third Tab</a><!-- each tab link makes the corresponding div visible --><div title="tabs" id="tabs1">
This is the First Tab
</div><div title="tabs" id="tabs2">
This is the Second Tab
</div><div title="tabs" id="tabs3">
This is the Third Tab
</div></body></html>
just copy paste this whole block of code into an html file and load it up and see what it does
HTML Code:
<html><head><!-- include jquery library from wherever you like --><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script><!-- this script runs the whole shebang --><script type="text/javascript">
function showonlyone(thechosenone) {
$('div[title|="tabs"]').each(function(index) {
if ($(this).attr("id") == thechosenone) {
$(this).show(0);
}
else {
$(this).hide(0);
}
});
}
</script><style type="text/css">
.tabs {display:none}
</style></head><body><!-- these links select the tab to display --><a id="tablink1" href="#" onclick="javascript:showonlyone('tabs1')">Show First Tab</a><br /><a id="tablink2" href="#" onclick="javascript:showonlyone('tabs2')">Show Second Tab</a><br /><a id="tablink3" href="#" onclick="javascript:showonlyone('tabs3')">Show Third Tab</a><br /><!-- each tab link makes the corresponding div visible --><div title="tabs" id="tabs1">
This is the First Tab
</div><div title="tabs" id="tabs2" class="tabs">
This is the Second Tab
</div><div title="tabs" id="tabs3" class="tabs">
This is the Third Tab
</div></body></html>
Last edited by damndaewoo; 05-21-2012 at 03:33 PM.
Reason: because I messed it up the first time
Will it work if i put in Show First Tab~(Link) and press link will it stay on Tablink1 if i press this Tab(Link), because i have frames in one this meniu in othen then i press Link from this meniu opened this Link but meniu must stay in the same position not change to TabLink2 or etc. I write to you know because saw that you are online i will check it today a little bit later
thank you of your help you really nice person
Anything you put in tab one will stay in tab one. If you click the tab two link, tab one will disappear and tab two will display and vice-versa. I really think you should copy past the whole block of code into a new html file and just play with it to see what it does.
Bookmarks