...

View Full Version : <DIV..> is breaking my line



ggallen
08-11-2004, 09:18 PM
Take the two scripts..

<TD WIDTH=10% ALIGN="LEFT">
<BUTTON OnClick="seladdr('1');" ALIGN="LEFT"><IMG SRC="/arrow.gif" width=17 height=13></BUTTON>
<DIV ID="ALABEL1">Business</DIV>
<SELECT ID='ADROP1' STYLE='display:none' ALIGN='LEFT' NAME='ASELFONE1' SIZE='1' OnChange="hideaddr('1');" OnBlur="hideaddr('1');">
</SELECT>
</TD>

<TD WIDTH=10% ALIGN="LEFT">
<BUTTON OnClick="seladdr('1');" ALIGN="LEFT"><IMG SRC="/arrow.gif" width=17 height=13></BUTTON>
Business
<SELECT ID='ADROP1' STYLE='display:none' ALIGN='LEFT' NAME='ASELFONE1' SIZE='1' OnChange="hideaddr('1');" OnBlur="hideaddr('1');">
</SELECT>
</TD>

The only difference between them is "Business" in enclosed in a <DIV>
I do this so I can access the .innerText and change the label.

When Business is not enclosed in the <DIV>, the image and Business both
fit on one line. When I enclose it in <DIV></DIV> the image is displayed
and then Business on the next line. Apparantly the <DIV> adds some extra
spacing. Enough that it makes it longer than my 10% allows for that column.

Is there anything I can do? (I tried using STYLE="spacing-left:0pt"..)

This is for IE.

OR, is there another way, I can reference the "Business" easily to change it.
without enclosing it with <DIVS> so I can give it an ID name?

George

GP1183
08-11-2004, 09:19 PM
<span>?

ggallen
08-11-2004, 09:29 PM
Excellent....Span work just perfectly. Thanks

George

Willy Duitt
08-11-2004, 09:32 PM
This is an HTML/CSS question not a javascript question....
However, the problem is is that <div> is a block level element and what you need to use is an inline element such as span as GP1183 advised...

And although these two replies would seemingly answer your question. This is only the beginning of the problems with that code snippet. I would advise P/M'ing a Moderator and ask to have this question moved to the HTML/CSS forum where you would recieve better help with these other problems....

......Willy

ggallen
08-11-2004, 09:37 PM
I put into the javascript area, since it involved the use of ID for
referencing with Javascript routines and use of .innerText.

As for whether there are better ways to accomplish the results
with what is in the code snippit.....it works, and works well.

However, I would like to hear any suggestions you might have
for future uses..

George

glenngv
08-12-2004, 04:48 AM
However, I would like to hear any suggestions you might have
for future uses..
George
Don't use innerText, it's an IE-only property. Use innerHTML or DOM instead.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum