Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Span Probelm

Status
Not open for further replies.

phpuser2000

Programmer
Jan 25, 2005
1
US
Hi All!
I have some probelms with using span to

for example:
if someone chooses non-us country i dont display the state ,zip and address but I display a non us field for them to enter.(which works fine)

The problem is when I use SPAN the space between the rows seem to change they seem to increase or decrease between the rows. Any suggestion how I can solve this problem?
Any examples woudl be really helpfull.

Thanks

and here is the code i am using .

<script language="javascript">
function mCheckCountry($obj)
{
if ($obj.value != 1)
{
ShowIt('non-us');
HideIt('phone')
HideIt('statezip');
}
else
{
ShowIt('statezip');
ShowIt('phone');
HideIt('non-us');

}
}

</script>



<tr>
<td class="coloredRightLabel">Country</td>
<td colspan="3">
<SELECT NAME="country_id" onChange="mCheckCountry(this)">
{html_options options=$arrCountryList selected=$arrRow.CountryUri}
</SELECT>
</td>
</tr>
............................ other html code here


<tr>
<td colspan="4" height=0>
<span id="non-us" style="display:none">
<table celpading="0" cellspacing="1" >
<tr>
<td width= 29% class="coloredSpecialLabel">Non-US Address</td>
<td colspan="3">

<TEXTAREA wrap="virtual" name="non_us_address" rows="6"
cols=45 align=top> {$arrRow.NonUSAddress}
</TEXTAREA>

</td>
</tr>
<tr>
<td width= 29% class="coloredSpecialLabel">Non-US Phone</td>
<td colspan="3">

<INPUT TYPE="text" NAME="non_us_phone" VALUE="{$arrRow.NonUsPhone}" size=20 maxlength=20>

</td>
</tr>
</table>
</td>
</span>
</tr>
..................... other HTML code here
 
Kinda hard to tell. You aren't even showing the HideIt/ShowIt functions.

If I had to guess (which I do), I'd say you're setting the "display" style to "none" in your hide it.

Instead of that, set the "visibility" style to "hidden" and "visible" respectively. This way, the space for the element remains the same, but the visibility is changed.

*cLFlaVA
----------------------------
[tt]tastes great, less filling.[/tt]
 
Also, if you are using spans, default switching of display would be between display: none; and display: inline;. If you start changing inline to block, this could show extra space.
 
Start by using valid code, here's what you've got
Code:
<td colspan="4" height=0>
<span id="non-us" style="display:none">
<table celpading="0" cellspacing="1" >
  ... snip ...
</table>
</td>
</span>
You can't put a <table> inside a <span>. <span>'s an inline element, <table>'s a block element. You'd have to use a <div> instead.

You also need to nest opening and closing tags properly. You've got [tt]<td><span> ... </td></span>[/tt]. It should be [tt]<td><div> ... </div></td>[/tt].

Fix trivial validation errors like this and you're ready to find the real problems with your page.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top