Reply
Stupid tabs =(
Old 11-27-2007, 07:33 PM Stupid tabs =(
Average Talker

Posts: 15
Name: Shane Faulkner
To make it easier to find since it is in the clutter, here is the live DEMO
http://privily.us

This is the original post asking for help and what I needed
Quote:
Ok so I need a better working way to do this

Code:
  <a id="poTer" onclick="switchMenu('poTerms');switchMenu('poTerH'); switchMenuBack('poContent');switchMenuBack('poTer');this.innerHTML='Hide Terms';" /> Show Terms </a>  <a id="poTab" onclick="switchMenu('poContent');switchMenu('poTabH');switchMenuBack('poTerms');switchMenuBack('poTab');this.innerHTML='Hide Options';" /> Show Options </a>
  <a style="display:none;" id="poTerH" onclick="switchMenu('poTerms');switchMenu('poTer'); switchMenuBack('poContent');switchMenuBack('poTerH');this.innerHTML='Show Terms';" /> Hide Terms </a>  <a style="display:none;" id="poTabH" onclick="switchMenu('poContent');switchMenu('poTab');switchMenuBack('poTerms');switchMenuBack('poTabH');this.innerHTML='Show Options';" /> Hide Options </a>
Thats in the HTML file and this is in a js file

Code:
<!--
function switchMenu(obj) {
    var el = document.getElementById(obj);
    if ( el.style.display != "none" ) 
    {
        el.style.display = 'none';
    }
    else 
    {
        el.style.display = '';
    }
}
function switchMenuBack(obj) {
    var el = document.getElementById(obj);
    if ( el.style.display != "" ) 
    {
        el.style.display = 'none';
        el.class
    }
    else 
    {
        el.style.display = 'none';
    }
}
//-->
I need the bottons to when they are clicked change the text to hide or show depending on weather or not the box is showing. When show options is clicked the options show and when youthen click Show Terms options is hidden and Terms is shown vise versa.

Here is a live demo of how it is workign witht he current code.
http://privily.us/
This is what someone gave me to help but does not work for some reason
Quote:
Originally Posted by CreativeLogic View Post
This is untested. I think this is what you're after. It could be done much easier if the html was coded differently but this should work fine.

Code:
<!--
function swap (element)
{
    var el = document.getElementById(element.id);
    var split = el.innerHTML.split (' ');
    if (split[0] == 'Hide')
    {
        // ##### SHOW CONTAINER ####
        document.getElementById(element.id + '_conainer').style.display = 'none';

        // ##### CHANGE TEXT #####
        el.innerHTML = 'Show ' + split[1];
    }
    else
    {
        // ##### HIDE CONTAINER ####
        document.getElementById(element.id + '_conainer').style.display = 'none';

        // ##### CHANGE TEXT #####
        el.innerHTML = 'Hide ' + split[1];
    }
}

function hide (id)
{
    // ##### HIDE CONTAINER ####
    document.getElementById(id + '_conainer').style.display = 'none';

    // ##### CHANGE TEXT #####
    var el = document.getElementById(id);
    var split = el.innerHTML.split (' ');
    el.innerHTML = 'Show ' + split[1];
}
//-->
Your links should be like this:
Code:
<a id="terms" onclick="swap (this); hide ('options');" />Show Terms</a>
<a id="options" onclick="swap (this); hide ('terms');" />Show Options</a>
Your containers should be like this:
Code:
<div id="terms_container" style="display: none;"><!-- ANY TEMRS HTML HERE --></div>
<div id="options_container" style="display: none;"><!-- ANY OPTIONS HTML HERE --></div>
and this is my code now
Quote:
Originally Posted by querk View Post
Thanks for the help but I am still runnin into troubles
The site is updated for a live preview of what it is doing and here is my code.

HTML ALL
Code:
<?php 

if (basename(__FILE__) == basename($_SERVER['PHP_SELF']))
{
    exit(0);
}

echo '<?xml version="1.0" encoding="utf-8"?>';

$showTerms = false;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Privily.us | Browse with the freedom you deserve!</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="author" content="Southern Media" />
<meta name="Description" content="http://www.southernmedia.com.ar" />
<link rel="stylesheet" type="text/css" href="inc/styles/common.css" media="all" />
<script src="inc/js/showhide.js" type="text/javascript"></script>
</head>
<body bgcolor="#FFFFFF" onload="document.getElementById('address_box').focus()">
<div id="wrap">
  <div id="header">
    <div id="logo">
      <h1>Privily.us</h1>
      <div id="tagline"><strong>Browse with the freedom you deserve! </strong></div>
      <div id="menu"> <a href="<?php echo $GLOBALS['_script_base'] ?>">URL Form</a> • <a href="javascript:alert('cookie managment has not been implemented yet')">Manage Cookies</a> • <a href="#">Login</a> • <a href="#">Members</a> </div>
    </div>
    <div id="banner">
      <script type="text/javascript"><!--
google_ad_client = "pub-4808569320609367";
//234x60, created 11/26/07
google_ad_slot = "4360867620";
google_ad_width = 234;
google_ad_height = 60;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
    </div>
  </div>
  <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
    <div id="search-bar">
      <fieldset>
      <label>
      <input id="search-field" type="text" name="<?php echo $GLOBALS['_config']['url_var_name'] ?>" value="<?php echo isset($GLOBALS['_url']) ? $GLOBALS['_url'] : '' ?>" onfocus="this.select()" />
      </label>
      <label>
      <input id="search-submit" onclick="return submit_form();" type="image" src="../../img/submit.gif" />
      </label>
      </fieldset>
    </div>
    <!--*<div id="poTerms" class="lAlign" style="display:none;">-->
    <div id="terms_container" style="display: none;">
      <p id="terms"> By using the services provided by Privily.us you fully agree to our Terms Of Service. If you do not fully agree then please leave.<br>
        <br>
        User agrees that user shall not hold Privily.us and/or any affiliates liable of any claims, liabilities, losses, costs, damages, expenses, including attorney fees and court costs that arise from any judgments directly or indirectly created by the services of Privily.us and/or affiliates to the customer. <br>
        <br>
        Privily.us shall not be liable under any circumstances for any damages the users business may suffer for any reason, even if Privily.us has been advised of the possibility of such damages. If a problem occurs even if that is within Privily.us's control, as the internet is unpredictable, user is aware that network availability is not guaranteed. Privily.us and/or affiliates shall not be liable for any legal claims from you, the user. <br>
        <br>
        All services provided by Privily.us may only be used for lawful purposes and lawful to access lawful content. Unlawful uses may result in a temporary or permenant ban from Privily.us and/or its affiliates. User agrees to indemnify and hold harmless Privily.us and/or affiliates from any claims resulting from the use of the service that damages the user or any other party. User agrees to take full responsiblity. <br>
        <br>
        Privily.us reserves the right to make changes to our Terms of service at any time without any notification. Changes to our Terms of service take effect immediately upon being posted on our website. It is users responsibilty to update user on any changes, Privily.us is not obliged to notify use of any changes. <br>
        <br>
        Last Updated: November 26, 2005</p>
    </div>
    <!--<div id="poContent" style="display:none;">-->
    <div id="options_container" style="display: none;">
      <table id="options" align="left">
        <?php
      
                          foreach ($GLOBALS['_flags'] as $flag_name => $flag_value)
                          {
                              if (!$GLOBALS['_frozen_flags'][$flag_name])
                              {
                                  echo '
                                    <tr><td id="options"><input type="checkbox" name="' . $GLOBALS['_config']['flags_var_name'] . '[' . $flag_name . ']"' . ($flag_value ? ' checked="checked"' : '') . ' /></td><td id="options">' . $GLOBALS['_labels'][$flag_name][1] . '</td></tr>' . "\n";
                              }
                          }
                      ?>
      </table>
      <div style="float:right;"><p id="ex">We recomend that only advanced users change these settings.  The settings that are currently pre-set and checked by default are the recomended settings for anonymity.  However, we (Privily.us) do not under any circumstances guarantee that your privacy and protection is 100% using these settings or any other combination of settings with this proxy.</p></div>
    </div>
  </form>
  <a id="terms" onclick="switchMenu('terms_container');swap (this); hide ('options');" />Show Terms</a> <a id="options" onclick="swap (this); hide ('terms');" />Show Options</a>
  <div id="body" style="display:none;"> </div>
</div>
<div id="footer">
  <p>All Content Copyright © 2006, Privily.us<br />
  </p>
</div>
</body>
</html>
JS File
Code:
<!--
function switchMenu(obj) {
    var el = document.getElementById(obj);
    if ( el.style.display != "none" ) 
    {
        el.style.display = 'none';
    }
    else 
    {
        el.style.display = '';
    }
}
function switchMenuBack(obj) {
    var el = document.getElementById(obj);
    if ( el.style.display != "" ) 
    {
        el.style.display = 'none';
        el.class
    }
    else 
    {
        el.style.display = 'none';
    }
}
<!--
function swap (element)
{
    var el = document.getElementById(element.id);
    var split = el.innerHTML.split (' ');
    if (split[0] == 'Hide')
    {
        // ##### SHOW CONTAINER ####
        document.getElementById(element.id + '_conainer').style.display = 'none';

        // ##### CHANGE TEXT #####
        el.innerHTML = 'Show ' + split[1];
    }
    else
    {
        // ##### HIDE CONTAINER ####
        document.getElementById(element.id + '_conainer').style.display = 'none';

        // ##### CHANGE TEXT #####
        el.innerHTML = 'Hide ' + split[1];
    }
}

function hide (id)
{
    // ##### HIDE CONTAINER ####
    document.getElementById(id + '_conainer').style.display = 'none';

    // ##### CHANGE TEXT #####
    var el = document.getElementById(id);
    var split = el.innerHTML.split (' ');
    el.innerHTML = 'Show ' + split[1];
}
//-->
//-->
I really need help please?

Last edited by querk : 11-27-2007 at 07:37 PM.
querk is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 11-27-2007, 07:35 PM Re: Stupid tabs =(
chrishirst's Avatar
Super Moderator

Posts: 15,291
Location: Blackpool. UK
and the url where we can see this working (or not) would be?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System | Bits & Bobs
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-27-2007, 07:37 PM Re: Stupid tabs =(
Average Talker

Posts: 15
Name: Shane Faulkner
In the top, http://privily.us

I have also added it to the top so that it is easier to find. It was located within two of the quotes but not easy to spot.

Last edited by querk : 11-27-2007 at 07:38 PM.
querk is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Stupid tabs =(
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Webmaster Resources Marketplace:
Software Development Company | Webhosting.UK.com | Text Link Brokers 


   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13419 seconds with 12 queries