SitePoint Sponsor |
|
User Tag List
Results 1 to 9 of 9
-
Dec 10, 2003, 14:37 #1
Would like to make a script work with Mozilla
I found this example of a script for finding the top and left edge of an element on a page, which is great. Their demo works fine in Mozi.
http://1ppl.free.fr/html/article077.html
I altered it so that it gets the top and left edges of a table instead of a div and then uses that information to position a div on the screen with a line like this:
document.writeln('<div id="content8" style="left:' + (getAbsoluteLeft("mainTable") + 540) + 'px; top:' + (getAbsoluteTop("mainTable") + 315) + 'px;"><p class="homeTitles"><strong>A message from our chairman</strong></p><p class="homeCopy"><strong>Copy to follow.</strong></p></div>')
See what I'm doing? This works fine in IE but not in Mozi? Is this because Mozi doesn't support getting the position of a table but does support it in divs, or is it something else? Is there any way to achieve this in Mozi? I've thought of a workaround involving nesting a div in a table and my table in that div, but it's a bit messy to say the least!
Thanks in advance.
GDrupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
Dec 10, 2003, 17:33 #2
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Hi greg,
Is the page online? I was wondering if this code runs before window.onload - mainTable may not yet exist. Or is this script element in the html, after mainTable?
The functions from 1ppl are fine. You shouldn't have to modify them. Are they in a script element before or after your code above?Cross-Browser.com, Home of the X Library
-
Dec 11, 2003, 08:31 #3
Hi,
It's not online at the moment. But the script elements are dealt with after mainTable is rendered. I came across that problem initially, but sussed out what was going on myself and put the script for displaying last. As I say, it works fine in IE and it kind of works in Mozi, but what it isn't doing is finding the left edge of the table accurately (I think).
I'm not on a machine with Mozi today (hiding in a different office so I can actually get on with some work!!) -- it's an old PII Vaio and it's struggling enough without me giving it something else to worry about!
GDrupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
Dec 11, 2003, 10:23 #4
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Try letting the table have "position:relative" in css.
Cross-Browser.com, Home of the X Library
-
Dec 11, 2003, 11:03 #5
Hmmm.... didn't work.
Back on a Mozi machine now. What it's doing is it's measuring the top edge fine, but it's measuring from the left hand side of the screen rather than the left hand side of the table.
Drupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
Dec 11, 2003, 11:26 #6
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Without seeing the page or at least some of the relevant code... I can only guess.
Cross-Browser.com, Home of the X Library
-
Dec 11, 2003, 11:26 #7
God, this is killing me! I even tried positioning a little div tag in the top left table cell and using that. Again, IE happy, Mozi not! And yet the demo works fine!!
Drupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
Dec 11, 2003, 11:38 #8
It's ok. You were along the right lines. For some reason Mozi refuses to pick up the left edge of a table, even if you specify it's positioning in CSS. However, I added a little div with the ID of "marker" and when I set it's position to absolute Mozi would read it's left hand edge. I'm now using an empty div in the top left corner of the table instead of the table itself to keep Mozi happy.
Thanks for your help Mike! I wouldn't have got there without you pointing me in the right direction!
GDrupal Development -- Hire me!
Drupal Training | Darwin Awards Moderator | Classic Cars
SitePoint | Blog | Rent Games Online | Car | Talent
-
Dec 11, 2003, 11:39 #9
- Join Date
- Dec 2002
- Location
- Alabama, USA
- Posts
- 2,560
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You're welcome, Greg. I'm glad you found a solution.
Cross-Browser.com, Home of the X Library
Bookmarks