Forum Moderators: open

Message Too Old, No Replies

javascript not centered properly in a div

         

cjwsb

10:10 pm on Nov 14, 2003 (gmt 0)

10+ Year Member



Hi all,

Probably an easy one, but I can't seem to get it working. It WAS working, but darned if I know what happened...

<sorry, no URLs to member's sites>

There is a scrolling marquee javascript at the top. It is centered perfectly in IE, but it is off to the left (next to the left-aligned div) in NS7 and Opera. Anyone know why? Thanks!

Oh, and I almost forgot... On that same page, in the middle, there is a link to the Macromedia website that I have set to open in a new browser window, using the "target="resource_window" attribute. That is not w3c compliant and is hindering my site from w3c validation. How can I get that link to open in a new browser window that IS w3c compliant? Thanks!

Chris

[edited by: tedster at 10:30 pm (utc) on Nov. 14, 2003]

tedster

10:46 pm on Nov 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here's a guess about the centering problem -- you may have set proper text-align: rule in the containing or parent div, but your javascript may be writing a child div with a different rule. Or, it's also possible that the rule may not be getting inherited properly in all browsers. In either case, look into your javascript to see how you can explicitly write in the centering.

When it comes to the target attribute and strict doctypes, we've kicked that one around a lot here. It is a challenge -- we've discussed it on maybe 30 threads at this point. Here was one pretty thorough thread on the topic from July:

[webmasterworld.com...]

The short answer is that only javascript can be used to open a new window with a strict doctype.

cjwsb

2:58 am on Nov 15, 2003 (gmt 0)

10+ Year Member



Thanks a million, tedster! I'll let you know how it all works out!

Chris

cjwsb

3:34 am on Nov 15, 2003 (gmt 0)

10+ Year Member



Ok, I looked and don't see any way of changing the centering of the script in the script itself. Then again, I don't know javascript all that well. For some reson, I can't post the url, but I will try again.

<snip>

Any other thoughts would be greatly appreciated!

Chris

[edited by: korkus2000 at 1:14 am (utc) on Nov. 16, 2003]
[edit reason] No personal URLs please [/edit]

cjwsb

12:46 pm on Nov 15, 2003 (gmt 0)

10+ Year Member



Never mind, bro. I got it all working and validating this morning. Had to add onclick="this.target='_blank';" to the shockwave link and add a table with align="center" to the div. Works great and validates as strict. Thanks for the pointers!

Chris

cjwsb

12:54 pm on Nov 15, 2003 (gmt 0)

10+ Year Member



OOPS! Nevermind... That didn't work either. By adding the table, it works fine in NS and Opera now, but the script is misaligned in IE now! What's up?

Chris