DIV issue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to load a Virtual Earth map on my page. The instructions say to
create a div and then place it there. Everything works fine EXCEPT I can't
get the map to center on the page.

If I use <center> the page crashes. If I use align=center in the div
statement, it's ignored (it also ignores if I put align=left or align=right).
I've also tried using quote marks (i.e., align="center", etc.) and it just
left aligns the map.

The div statement contains a style reference, but I've tried it with it
taken out also and it still doesn't work. The ID for the div statement and
the map are the same.

Here's my code:

<div id='roadmap' align=center></div>

<script>

var FirstMap = new VEMap('roadmap');

FirstMap.LoadMap(new VELatLong(Latitude, Longitude), 14,
VEMapStyle.Road, false);

FirstMap.HideDashboard();

//Create a pushpin and add it to the map


// Latitude, Longitude, PushPinHeading and PushPinNote are
variables passed in the URL. Code exists to populate these variables and
it's working fine.
var FirstPushPin = new VEPushpin('1', new VELatLong(Latitude,
Longitude), null, PushPinHeading, PushPinNote);

FirstMap.AddPushpin(FirstPushPin);

</script>


Does anyone know how to make it work? I'm using IE7.

Thanks,

Michael
 
In Michael had this to say:

My reply is at the bottom of your sent message:
I'm trying to load a Virtual Earth map on my page. The instructions
say to create a div and then place it there. Everything works fine
EXCEPT I can't get the map to center on the page.

If I use <center> the page crashes. If I use align=center in the div
statement, it's ignored (it also ignores if I put align=left or
align=right). I've also tried using quote marks (i.e.,
align="center", etc.) and it just left aligns the map.

The div statement contains a style reference, but I've tried it with
it taken out also and it still doesn't work. The ID for the div
statement and the map are the same.

Here's my code:

<div id='roadmap' align=center></div>

<script>

var FirstMap = new VEMap('roadmap');

FirstMap.LoadMap(new VELatLong(Latitude, Longitude), 14,
VEMapStyle.Road, false);

FirstMap.HideDashboard();

//Create a pushpin and add it to the map


// Latitude, Longitude, PushPinHeading and PushPinNote are
variables passed in the URL. Code exists to populate these variables
and it's working fine.
var FirstPushPin = new VEPushpin('1', new
VELatLong(Latitude, Longitude), null, PushPinHeading, PushPinNote);

FirstMap.AddPushpin(FirstPushPin);

</script>


Does anyone know how to make it work? I'm using IE7.

Thanks,

Michael

Set the class roadmap in CSS and center it that way? This is JUST a guess
and not a fact. I don't /think/ that the center attribute for the div class
is really supported in any browser - it's not a real attribute in other
words. People yelled that IE wasn't up to standards and, well, it is and so
now when you see stuff that crashes (again this is not 100% sure) that's
likely the reason. Either way... This is IE6 according to the title...
*points up*

For IE7questions please see:

In a newsreader:
news://msnews.microsoft.com/microsoft.public.internetexplorer.general

On the web:
http://www.microsoft.com/communitie...?dg=microsoft.public.internetexplorer.general

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/ http://kgiii.info/

"Chance has put in our way a most singular and whimsical problem, and
its solution is its own reward." - Sherlock Holmes
 
Michael said:
I'm trying to load a Virtual Earth map on my page. The instructions say to
create a div and then place it there. Everything works fine EXCEPT I can't
get the map to center on the page.

If I use <center> the page crashes. If I use align=center in the div
statement, it's ignored (it also ignores if I put align=left or align=right).
I've also tried using quote marks (i.e., align="center", etc.) and it just
left aligns the map.

The div statement contains a style reference, but I've tried it with it
taken out also and it still doesn't work. The ID for the div statement and
the map are the same.

Here's my code:

<div id='roadmap' align=center></div>

<script>

var FirstMap = new VEMap('roadmap');

FirstMap.LoadMap(new VELatLong(Latitude, Longitude), 14,
VEMapStyle.Road, false);

FirstMap.HideDashboard();

//Create a pushpin and add it to the map


// Latitude, Longitude, PushPinHeading and PushPinNote are
variables passed in the URL. Code exists to populate these variables and
it's working fine.
var FirstPushPin = new VEPushpin('1', new VELatLong(Latitude,
Longitude), null, PushPinHeading, PushPinNote);

FirstMap.AddPushpin(FirstPushPin);

</script>


Does anyone know how to make it work? I'm using IE7.

Thanks,

Michael
Possible solution:
<div style="text-align: center;">
<div style="text-align: left; margin: 1em auto; width: 50%;">
</div>
</div>
From: http://dorward.me.uk/www/centre/#ie
Good Luck
photog
 
Why Microsoft would document the ALIGN feature of DIV and not have it work is
beyond me. The only thing I can think of is the examples Microsoft gives is
something like this:

<div align=center>
This text is centered.
</div>

The problem is that the example code they give for incorporating maps in
your web site is to do this:

<div id='123'></div>

I tried putting the map script between <div> and </div> and it just doesn't
work.

Also, I would have posted to an IE7 Newsgroup if there was one.

Thanks,

Michael
 
I tried your suggestion. It was a good idea, but unfortunately, it didn't
work. I'm still looking for a solution. Anybody got one?

Thanks,

Michael
 
In Michael had this to say:

My reply is at the bottom of your sent message:
Why Microsoft would document the ALIGN feature of DIV and not have it
work is beyond me. The only thing I can think of is the examples
Microsoft gives is something like this:

<div align=center>
This text is centered.
</div>

The problem is that the example code they give for incorporating maps
in your web site is to do this:

<div id='123'></div>

I tried putting the map script between <div> and </div> and it just
doesn't work.

Also, I would have posted to an IE7 Newsgroup if there was one.

Thanks,

Michael

I took a look at W3C and it looks as though it is valid, depreciated in the
XHTML 1.0 and HTML 4.x and was dropped entirely in XHTML 4.1 in favor of
positioning in CSS. I'd have to see the article on the Microsoft site and
check the age - I suspect it's dropped entirely in IE7 but I'm still in the
process of typing this reply and thus haven't tested that at all. IE has, in
the past, been guilty of not adhering to standards and part of the benefit
of that was that things that were no longer ratified or hadn't been ratified
by the consortum were still able to be used.

Additionally there is an IE7 group, it's just not stated in the title.
*sigh* I know, I know... It's just the general group and that's surely going
to make the waters even more murky. On top of that - and I don't want to
sound like I'm whining and you truly may not care but if you're a designer
you just might - they're also killing off a bunch of the older IE groups in
the process. Great... Now we get 'em all in one giant cluster.

Anyhow, enough of the silliness. Let's go take a look at your code.

I took a look, played and poked, and then I noticed something...

<div id='roadmap' align=center></div>

<script>

var FirstMap = new VEMap('roadmap');

FirstMap.LoadMap(new VELatLong(Latitude, Longitude), 14,
VEMapStyle.Road, false);

FirstMap.HideDashboard();

//Create a pushpin and add it to the map


// Latitude, Longitude, PushPinHeading and PushPinNote are
variables passed in the URL. Code exists to populate these variables and
it's working fine.
var FirstPushPin = new VEPushpin('1', new VELatLong(Latitude,
Longitude), null, PushPinHeading, PushPinNote);

FirstMap.AddPushpin(FirstPushPin);

</script>

Umm...

Try this:

<div id='roadmap' align=center>

<script>

var FirstMap = new VEMap('roadmap');

FirstMap.LoadMap(new VELatLong(Latitude, Longitude), 14,
VEMapStyle.Road, false);

FirstMap.HideDashboard();

//Create a pushpin and add it to the map


// Latitude, Longitude, PushPinHeading and PushPinNote are
variables passed in the URL. Code exists to populate these variables and
it's working fine.
var FirstPushPin = new VEPushpin('1', new VELatLong(Latitude,
Longitude), null, PushPinHeading, PushPinNote);

FirstMap.AddPushpin(FirstPushPin);

</script>

</div>


The code didn't work for me - of course - so I filled the center script bit
with an image and then did it which is why I ended up noticing the <div> tag
was closed before the script was called.

That do it?

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/ http://kgiii.info/

"Chance has put in our way a most singular and whimsical problem, and
its solution is its own reward." - Sherlock Holmes
 
Yes, I thought too that the script had to be within the <div> and </div>
markers, but I tried it and it just isn't working. It's really frustrating
because it's such a simple thing and MS's documentation says you can use
align=center in a <div> tag, but in this case it just isn't working.

It seems that any attempt I make to center the maps just causes an error.
If I use <center> and </center> - error. If I try putting it in a table and
center the table or field within the table - error. The one thing I haven't
tried yet is creating a frameset to make it look like it's centered, but
there's gotta be an easier way!

Thanks for your help. I appreciate it. Any other ideas you have would be
great.

Thanks,

Michael

P.S. I'm not a developer. I'm just a regular guy trying to make something
that should be easy work.
 
In Michael had this to say:

My reply is at the bottom of your sent message:
Yes, I thought too that the script had to be within the <div> and
</div> markers, but I tried it and it just isn't working. It's
really frustrating because it's such a simple thing and MS's
documentation says you can use align=center in a <div> tag, but in
this case it just isn't working.

It seems that any attempt I make to center the maps just causes an
error. If I use <center> and </center> - error. If I try putting it
in a table and center the table or field within the table - error.
The one thing I haven't tried yet is creating a frameset to make it
look like it's centered, but there's gotta be an easier way!

Thanks for your help. I appreciate it. Any other ideas you have
would be great.

Thanks,

Michael

P.S. I'm not a developer. I'm just a regular guy trying to make
something that should be easy work.

I trimmed out a lot via snipping.

Anyhow...

How about you set a class in CSS and center it there or, if need be,
position it to fit the alignment by setting the number of pixels (or
percent) that it will use for the left margin? If that doesn't work then,
well, I'm plum out of ideas as well. *sigh*

--
Galen - MS MVP - Windows (Shell/User & IE)
http://dts-l.org/ http://kgiii.info/

"Chance has put in our way a most singular and whimsical problem, and
its solution is its own reward." - Sherlock Holmes
 
Back
Top