All pastes #940428 Raw Edit

tabs with prototype.js

public javascript v1 · immutable
·published 2008-03-12 23:28 UTC
rendered paste body
<html>        <head>                <title>Control.Tabs : Unobtrusive CSS Tabs for Prototype</title>                <link rel="stylesheet" href="http://livepipe.net/styles/screen.css"/>                <script src="http://livepipe.net/scripts/prototype.js"></script>                <script src="http://livepipe.net/downloads/object.event.1.0.0.js"></script>                <script src="http://livepipe.net/downloads/control.tabs.2.0.0.RC2.js"></script>        </head>        <body>                <br><br><br>                <div id="outer_container">                 <div id="main">                        <ul id="tabs_example_one" class="subsection_tabs">                                <li><a href="#one">One</a></li>                                <li><a href="#two">Two</a></li>                                <li><a href="#three">Three</a></li>                        </ul>                        <div id="one"><p>First tab</p></div>                        <div id="two"><p>Second tab</p></div>                        <div id="three"><p>Third tab</p></div>                        <?php                                $activetab="two";                                if( isset( $_POST['submit1'] ) ) {                                        $activetab=$_POST['activetab'];                                        echo "Previously active tab = $activetab";                                }                                echo '<form id="myform" name="myform" method="post" action="' . $_SERVER['SCRIPT_NAME'] . '">';                                echo '<input type="text"   name="text"   value="some text">';                                echo '<input type="submit" name="submit1" value="submit 1">';                        ?>                        <input type="hidden" name="activetab" id="activetab" value="<?php echo $activetab ?>">                        <script>                                new Control.Tabs('tabs_example_one',{afterChange: function(new_container){document.getElementById('activetab').value=new_container.id;}});                          Control.Tabs.findByTabId('one').setActiveTab('<?php echo $activetab ?>');                        </script>                        </form>                </div>                </div>        </body></html>