SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Coding Help: Can't execute same function more than once?

    Hi All,

    I'm having trouble executing a function that hides or shows a hidden <tr>

    If I run it like this, it only shows the first tab:
    HTML Code:
    <script type="text/javascript">
    showTab('tabs_id', 'Yes');
    
    showTab('notes_id', 'Yes');
    
    showTab('binder_sizes_id', 'Yes');
    </script>
    But if I run it like this, all 3 tabs show up:
    HTML Code:
    <script type="text/javascript">
    showTab('tabs_id', 'Yes');
    </script>
    <script type="text/javascript">
    showTab('notes_id', 'Yes');
    </script>
    <script type="text/javascript">
    showTab('binder_sizes_id', 'Yes');
    </script>
    Thanks

    Here's the full html:
    HTML Code:
    <!-- header -->
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Z Values Copy Center</title>
    
    <script type="text/javascript">
    // dynamically fixes the hidden iframe
    function resizeIframe(padding) {
    
        var i;
        var iHeight;
    
        // if no padding is set, give a default size of 25
        if (isNaN(padding))
        {
            padding = 25;
        }
    
    	// Must launched on the body onload event handler for IE
    	// Use document.documentElement if you are in Compat mode
    	i = parent.document.getElementById(window.name)
    	iHeight = document.body.scrollHeight
    	i.style.height = iHeight + padding + "px"
    }
    
    // allows return to be used to submit a form
    function enterKey(evt)
    {
      var evt = (evt) ? evt : event
      var charCode = (evt.which) ? evt.which : evt.keyCode
      if (charCode == 13)
      {
        document.form.submit();
      }
    }
    </script>
    
    <!-- link href="https://my.lennar.com/portal/wps/themes/html/BlackTheme/en/Styles.css" rel="stylesheet" type="text/css" />
    <link href="http://lennar.com/App_Themes/LogicOfLennar/lennar.css" rel="stylesheet" type="text/css" /-->
    <link href="/style.css" rel="stylesheet" type="text/css" />
    
    </head>
    <body onload="resizeIframe();document.body.onkeypress = enterKey;"  style="margin:0;border:none">
    <a name="top" />
    
    <br />
    <table border="0" cellpadding="0" cellspacing="0" width="100&#37;">
        <tr>
            <td colspan="2">
                <!--table border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr valign="bottom">
                        <td><span class="heading">Z Values Copy Center</span></td>
                         <td>Step 3 of 3</td>                </tr>
                    <tr>
                    	<td colspan="2" background="images/dot.gif" height="3"></td>
                    </tr>
                </table>
                <br ///-->
    
     <!-- Displays what step the user is at //-->
        <span class="blank">Step 1 - Delivery Info</span> <img src="/images/gray_arrow.gif" />
        <span class="blank">Step 2 - Upload Files</span> <img src="/images/gray_arrow.gif" />
        <span class="current_step">Step 3 - Set Print Options</span>
            </td>
         </tr>
        <tr valign="top">
        	<td colspan="5" height="325">
    	        <h3 align="center"></h3>
    			<div class="lineheight19">
    			
    	        	        
    
    <br />
    
    
    <!-- //header -->
    <script type="text/javascript">
    // shows or hides the hidden tabs after the user selects "Yes" or "No"
    function showTab(id, value)
    {
        if (value == 'Yes')
        {
            try{document.getElementById(id).style .display = 'block';}catch(er){}
            // cross browser style hack style.display = 'table-row'is ff only
            try{document.getElementById(id).style .display = 'table-row';}catch(er){}
    
        }
        else
        {
            document.getElementById(id).style.display = 'none';
        }
        // fix the iFrame size after showing/hiding the tabs
        resizeIframe(0); // set to 0 to prevent ff from growing the screen when turning on/off the view
    }
    
    
    </script>
    
    <br />
    <form name="form" method="post" action="print_options.php">
    <table cellpadding="0" cellspacing="0" width="615" border="0">
    	<!-- Job Name //-->
    	<tr>
    		<td class="" width="175">JOB NAME:</td>
    		<td><span class="required">*&nbsp;</span><input type="text" name="job_name" value="asdf" size="50"></td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    	<!-- Color Type //-->
    	<tr>
    		<td class="">COLOR TYPE:</td>
    		<td><span class="required">*</span> <select name="color_type">
    <option label="&nbsp;&nbsp;- Select One -" value="">&nbsp;&nbsp;- Select One -</option>
    <option label="Black and White" value="B&amp;W" selected="selected">Black and White</option>
    <option label="Color" value="Color">Color</option>
    <option label="Combination" value="Combination">Combination</option>
    </select>
    </td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
        <!-- Sides //-->
    	<tr>
    		<td class="">SIDES:</td>
    		<td><span class="required">*</span> <select name="sides">
    <option label="- Select One -" value="">- Select One -</option>
    <option label="Single" value="Single">Single</option>
    <option label="Double Sided" value="Double Sided" selected="selected">Double Sided</option>
    </select>
    </td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    	<!-- Paper Size //-->
    	<tr>
    		<td class="">PAPER SIZE:&nbsp;</td>
    		<td><span class="required">*</span> <select name="paper_size">
    <option label="- Select One -" value="">- Select One -</option>
    <option label="Letter &nbsp;&nbsp;&nbsp;(8.5 x 11)" value="Letter" selected="selected">Letter &nbsp;&nbsp;&nbsp;(8.5 x 11)</option>
    <option label="Legal &nbsp;&nbsp;&nbsp;&nbsp;(8.5 x 14)" value="Legal">Legal &nbsp;&nbsp;&nbsp;&nbsp;(8.5 x 14)</option>
    <option label="Tabloid &nbsp;(11 x 17)" value="Tabloid">Tabloid &nbsp;(11 x 17)</option>
    </select>
    </td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    	<!-- Total Quantity //-->
    	<tr>
    		<td class="">TOTAL QUANTITY:&nbsp;</td>
    		<td><span class="required">*</span> <input type="text" name="total_qty" value="234234" size="5"><br />
    		<span class="smallfont"><br />&nbsp;&nbsp;&nbsp;Minimum Print Quantity: 1 BW / 1 Color</span></td>
    	</tr>
        <tr>
            <td colspan="2">&nbsp;<br /><br /></td>
        </tr>
    
        <!-- 3 HOLE PUNCH //-->
    	<tr>
    		<td>3-HOLE&nbsp;PUNCH:&nbsp;</td>
    		<td><label><input type="radio" name="is_hole_punch" value="Yes" checked="checked" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="is_hole_punch" value="No" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    
    	<!-- CARDSTOCK //-->
    	<tr>
    		<td>CARDSTOCK:&nbsp;</td>
    		<td><label><input type="radio" name="is_cardstock" value="Yes" checked="checked" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="is_cardstock" value="No" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    
    	<!-- LAMINATION //-->
    	<tr>
    		<td>LAMINATION:&nbsp;</td>
    		<td><label><input type="radio" name="is_lamination" value="Yes" checked="checked" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="is_lamination" value="No" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    
    	<!-- COLLATE IN ORDER //-->
    	<tr>
    		<td width="100">COLLATE&nbsp;IN&nbsp;ORDER:&nbsp;</td>
    		<td><label><input type="radio" name="is_collate" value="Yes" checked="checked" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="is_collate" value="No" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
        <tr><td>&nbsp;</td></tr>
    
    	<!-- BINDING //-->
    	<tr>
    		<td>BINDING:&nbsp;</td>
    		<td><select name="binding">
    <option label="None" value="None">None</option>
    <option label="Staple" value="Staple" selected="selected">Staple</option>
    <option label="Paper Clip" value="Paper Clip">Paper Clip</option>
    <option label="Comb Binding" value="Comb Binding">Comb Binding</option>
    <option label="Binder Clip" value="Binder Clip">Binder Clip</option>
    </select>
    </td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    
    	<!-- INSERT INTO BINDER //-->
        <tr>
    		<td>INSERT&nbsp;INTO&nbsp;BINDER:&nbsp;</td>
    		<td><label><input type="radio" name="is_insert_binder" value="Yes" checked="checked" onclick="showTab('binder_sizes_id', this.value)" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="is_insert_binder" value="No" onclick="showTab('binder_sizes_id', this.value)" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
    	<tr id="binder_sizes_id" style="display:none;">
    	   <td>&nbsp;</td>
    	   <td><select name="binder_sizes">
    <option label="Select Size" value="">Select Size</option>
    <option label="1/2&quot;" value="1/2&quot;">1/2&quot;</option>
    <option label="1&quot;" value="1&quot;">1&quot;</option>
    <option label="1.5&quot;" value="1.5&quot;">1.5&quot;</option>
    <option label="3&quot;" value="3&quot;">3&quot;</option>
    <option label="5&quot;" value="5&quot;">5&quot;</option>
    </select>
    </td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    
    	<!-- INSERT COLOR PAGES //-->
    	<tr>
    		<td>INSERT&nbsp;COLOR&nbsp;PAGES:&nbsp;</td>
    		<td><select name="color_pages">
    <option label="None" value="None">None</option>
    <option label="Pastel Pink" value="pastel_pink" selected="selected">Pastel Pink</option>
    <option label="Pastel Blue" value="pastel_blue">Pastel Blue</option>
    <option label="Red" value="red">Red</option>
    <option label="Golden Rod" value="golden_rod">Golden Rod</option>
    <option label="Pastel Yellow" value="pastel_yellow">Pastel Yellow</option>
    <option label="Pastel Green" value="pastel_green">Pastel Green</option>
    </select>
    </td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    
    	<!-- TABS //-->
    	<tr>
    		<td>TABS:&nbsp;</td>
    		<td><label><input type="radio" name="is_tab" value="Yes" checked="checked" onclick="showTab('tabs_id', this.value)" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="is_tab" value="No" onclick="showTab('tabs_id', this.value)" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    	<tr id="tabs_id" style="display:none;">
            <td>&nbsp;</td>
            <td>
    			<textarea name="tabs" cols="50" rows="10">Type tab names here. Hit Enter for next line.
    
    aaaaa</textarea>
           </td>
    	</tr>
    
    	<!-- PRINTING NOTES //-->
    	<tr>
    		<td>PRINTING&nbsp;NOTES:&nbsp;</td>
    		<td><label><input type="radio" name="has_notes" value="Yes" checked="checked" onclick="showTab('notes_id', this.value)" />Yes</label>&nbsp;&nbsp;&nbsp;
    <label><input type="radio" name="has_notes" value="No" onclick="showTab('notes_id', this.value)" />No</label>&nbsp;&nbsp;&nbsp;</td>
    	</tr>
    	<tr><td>&nbsp;</td></tr>
    	<tr id="notes_id" style="display:none;">
            <td>&nbsp;</td>
            <td>
    			<textarea name="notes" cols="50" rows="10">Type any special notes here. Hit Enter for next line.
    
    asdfasdfasdfasdf</textarea>
           </td>
    	</tr>
    
    	<!-- SUBMIT BUTTONS //-->
    	<tr>
    		<td colspan="2">
    		  <table width="100%">
    		      <tr>
    		          <td align="left"><a href="file_form.php" class="previous">&lt;&lt;Previous</a></td>
    		          <td align="right"><a href="#" onclick="javascript:document.form.submit()" class="lennarbutton">PREVIEW ORDER</a></td>
    		      </tr>
    		  </table>
    		</td>
    	</tr>
    </table>
    <input type="hidden" name="next_x" value="next" />
    </form>
    
    
    <script type="text/javascript">
    showTab('tabs_id', 'Yes');
    
    showTab('notes_id', 'Yes');
    
    showTab('binder_sizes_id', 'Yes');
    </script>
    <!-- footer -->
            <!-- a href="#top">Back To Top</a-->
    		</div> <!-- closes the lineheight19 class -->
        </td>
      </tr>
    </table>
    <a href="?debug=true">Debug On</a> | <a href="?debug=false">Debug Off</a>
    
    </body>
    </html>
    
    <!-- // footer -->

  2. #2
    SitePoint Zealot
    Join Date
    Sep 2007
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    works for me

  3. #3
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does it work for you in IE too?

    Do all 3 "hidden" form elements show up for you?

    1. Insert Into Binder
    2. Tabs
    3. Printing Notes

    If you click "Yes," a hidden form element may show up. The Yes and No options will always show.

    Could you let me know what browser and version you're using, if it still works?

    Thanks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •