473,397 Members | 1,985 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Position Problem

Dan
I'm trying to create a menu in javascript. I've created the bitmaps with
text over the top of them. The problem i'm having is that the positions
aren't correct. If I wrap the code in PRE tags, then this fixes it. But
this seems to be a bit of a hack, as apposed to finding what the bug is.
I've included examples of the problem below:

http://dracan.x-1.net/test/index.html (Demonstrates the problem)
http://dracan.x-1.net/test/index2.html (Using the PRE hacky fix)

The actual relevant javascript code is here:

http://dracan.x-1.net/test/menu.js

Thanks for any help,
Dan.
Jul 20 '05 #1
2 1532
Hi Dan,

You wrote:
I've created the bitmaps with text over the top of them.
I hope you're not using bitmaps but jpegs or gifs... ;-)
The problem i'm having is that the positions
aren't correct.
Just look in your JavaScript source, Line 29:

document.writeln (">" + obj_text + "<\DIV>\n");

To close a Tag you can't use <\DIV>. The backslash is to
escape characters, like \" or \n f.e. To close tags you have
to use the slash: </DIV>.
So, as your DIVS aren't closed properly, the second DIV is
into the first and it's position is relative to the margins
of the first divs, the same thing happens with the third div,
which is placed into the second div, and so on.
If I wrap the code in PRE tags, then this fixes it.


It shouldn't. Browserbug... :-)

Saludo
Paul.
Jul 20 '05 #2
Paul Wellner Bou <pa**********@united-scripts.com> writes:
If I wrap the code in PRE tags, then this fixes it.


It shouldn't. Browserbug... :-)


Not really,

The pre tag wrapper have the correct end tag, so the implicit missing
end tag for the divs are placed before the end tag of the pre element.
You could do the same by wrapping it in any block level element,
except div.

Example:
Incorrect code:
<body>
<div> foo <\div>
<div> bar <\div>
</body>
Browser interprets this as:
<body>
<div> foo <div>
<div> bar <div>
</div></div></div></div>
</body>

This is "correct" behavior (or at least expected). The end tag of div
elements are not optional, but the browsers are forgiving and accepts
it when you leave them out. It inserts the end tags where they are
needed. The </body> terminates an element that started before the
divs, so the divs need to be terminated first to preserve proper
nesting. You could see this pattern when looking at the innerHTML
of the generated page.

Incorrect code with pre's:
<body>
<pre><div> foo <\div></pre>
<pre><div> bar <\div></pre>
</body>
Browser interprets this as:
<body>
<pre><div> foo <div></div></div></pre>
<pre><div> bar <div></div></div></pre>
</body>

Here the pres force the divs to end, so they are not nested. It was
the nesting that positioned the elements incorrectly.

The code is illegal HTML, but tag-soup-browser error correction is
fairly predictable.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Falc2199 | last post by:
Hi all, I am using the "Poistion" attribute to correctly align a column of images that I have on a table. The code looks like so.... <TD valign="top" class="listinglight" align="left"> <A...
5
by: CMAR | last post by:
I have been having a problem styling a page, which you can see live at my test site: Designer Page (http://home.ne.rr.com/thespar/) (Ignore the missing pictures, which have not been uploaded.)...
8
by: Jaime Rios | last post by:
Hi, I created a COM AddIn for Word that performs the functions that it needs to, but I needed to add the ability for the toolbar created by the COM AddIn to remember it's last position and...
3
by: akunamatata | last post by:
Hello everyone, I contact this discussiongroup because I encountered a little problem with XSL. Let me explain it: I have following file "position.xml": <?xml version="1.0"?>...
8
by: Edward | last post by:
I used to do this all the time in HTML-table layouting. How do I do this in CSS? -------------------------------------------------- <table width="400px"> <tr> <td bgcolor="beige">one line of...
5
by: Roderik | last post by:
Hi, My logo images are positioned some more to the right in IE6 than in FF1.5. I like them to be as shown in FF1.5. Does anyone have a clue, why they are positioned differently in IE? Problem...
2
by: petermichaux | last post by:
Hi, It seems like determining element position in a web page is a difficult task. In the position reporting source code I've looked at there are special fixes for at least some versions of...
2
by: agbee1 | last post by:
Hello: I've finally made the effort to ween myself from overly using tables and use CSS for my positioning. However, I am having a problem with my navigational menu properly aligning in Firefox,...
5
by: DL | last post by:
Hi, My research on this NG hasn't produced a satisfactory answer. Here's what I want to do: move two div (s) (each has an image tag within) to another location on the same page. // no...
12
Frinavale
by: Frinavale | last post by:
I think I'm trying to do something impossible. I have a <div> element with a overflow style set to "scroll". In other words my <div> element allows the user to scroll the content within it. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.