Created
April 7, 2009 22:52
-
-
Save davidphasson/91520 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Scroll works on these links --> | |
<div id="navbar" style="padding: 5px;"> | |
<%= f.tab_button "general", link_to_function("General", "switch_tab('page_general');"), general_fields, { :current => true } %> | |
<%= f.tab_button "contact", link_to_function("Contact", "switch_tab('page_contact');"), contact_fields %> | |
<%= f.tab_button "dates", link_to_function("Dates", "switch_tab('page_dates');"), date_fields %> | |
<%= f.tab_button "times", link_to_function("Times", "switch_tab('page_times');"), time_fields %> | |
<%= f.tab_button "questions", link_to_function("Questions", "switch_tab('page_questions');"), question_fields %> | |
<%= f.tab_button "multisite", link_to_function("Multi-School Visits", "switch_tab('page_multisite');"), multisite_fields %> | |
<%= f.tab_button "comments", link_to_function("Comments", "switch_tab('page_comments');"), comment_fields %> | |
</div> | |
<!-- But not here --> | |
<div id="page_multisite" style="display: none;" class="form_tab"> | |
<%= render :partial => 'form_multisite', :locals => { :f => f } %> | |
<p> | |
<%= button_to_function "Prev", "switch_tab('page_questions');" %> | |
<%= button_to_function "Next", "switch_tab('page_comments');" %> | |
</p> | |
</div> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Operates on tabs with class "form_tab" - hides all but "tabname" | |
function switch_tab(tabname) | |
{ | |
tabs = $$('.form_tab'); | |
for ( var i in tabs ) | |
{ | |
tab = tabs[i]; | |
if(tabname == tab.id) | |
{ | |
tab.show() | |
$("tab_" + tab.id).className = "tab currtab" | |
} | |
else | |
{ | |
tab.hide(); | |
$("tab_" + tab.id).className = "tab" | |
} | |
} | |
scroll(0,0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment