A Problem with Spinners

Discussion in 'PHP' started by jawinn, Nov 30, 2006.

  1. #1
    I can quite get these to work. I can't get them to spin and reveal the content for each spinner. If anyone can tall me what I've done wrong I'd be greatful.

    Here is the code:

    
    <?php
    function start_section( $id, $title )
    {
    ?>
    <table cellspacing="0" cellpadding="0">
    <tr>
    <td width="30" valign="top">
    <a href="javascript: void twist('<?php echo($id); ?>');">
    <img src="/images/up.gif" border="0" id="img_<?php echo($id); ?>"/>
    </a>
    </td>
    <td width="90%">
    <h1><?php echo ($title); ?></h1>
    <div style="visibility:hidden;position:absolute;"
    	id="<?php echo($id); ?>" class="spin-content">
    <?php
    }
    function end_section()
    {
    ?>
    </div>
    </td>
    </tr>
    </table>
    <?php
    }
    function spinner_header()
    {
    ?>
    <style type="text/css">
    body { font-family: arial, veranda; }
    h1 { font-size: medium; border-bottom: 1px solid black; }
    .spin-content { font-size: small; margin-left: 10px; padding: 10px; }
    </style>
    <script language="Javascript">
    function twist( sid )
    {
    	imgobj = document.getElementById( "img_"+sid );
    	divobj = document.getElementById( sid );
    	if ( imgobj.src.match( "/images/up.gif"))
    	{
    		imgobj.src = "/images/down.gif";
    		divodj.style.position = "relative";
    		divobj.style.visibility = "visible";
    	}
    	else
    	{
    		imgobj.src = "/images/up.gif";
    		divodj.style.visibility = "hidden";
    		divobj.style.position = "absolute";
    	}
    }
    </script>
    <?php
    }
    ?>
    <html>
    <head>
    <?php spinner_header() ?>
    </head>
    <body>
    <?php start_section( "one", "Report part one" ) ?>
    This is the content for the first spinner.
    <?php end_section() ?>
    <?php start_section ( "two", "Report part two" ) ?>
    This is the content for the second spinner.
    <?php end_section() ?>
    </body>
    </html>
    
    
    Code (markup):
     
    jawinn, Nov 30, 2006 IP
  2. jawinn

    jawinn Active Member

    Messages:
    1,024
    Likes Received:
    32
    Best Answers:
    0
    Trophy Points:
    88
    #2
    This happens everytime I post a code problem in DP. I look at if for an hour, post a question, and two seconds later realize that I fat fingered something.

    Nevermind.................
     
    jawinn, Nov 30, 2006 IP