As a helpful sidenot, i think you'd benefit from NOT using onload=""


....


<script>
document.observe('dom:loaded', function () {
var onResize = function(e) {
       var viewport = document.viewport.getDimensions();
       var screen = $('screen');
       var s_view = screen.getDimensions();

       screen.style.positon = 'absolute';
       screen.style.left = (viewport.width - s_view.width)/2+'px';
       screen.style.top = (viewport.height - s_view.height)/2+'px';
   };

   Element.observe(window, 'resize', onResize);
});
</script>
<body>




On Wed, Jul 1, 2009 at 9:13 AM, serenobs <seren...@gmail.com> wrote:

>
> i used screen as a example.
> I used another word in real code.
>
> On 7월1일, 오후6시38분, Vladimir Tkach <tea...@gmail.com> wrote:
> > screen its reserved word in js
> >
> > 2009/7/1 serenobs <seren...@gmail.com>
> >
> >
> >
> >
> >
> >
> >
> > > I missed it.
> > > I'm using prototype 1.6.1.RC3.
> >
> > > On 7월1일, 오후6시08분, serenobs <seren...@gmail.com> wrote:
> > > > Hi again :)
> >
> > > > I'm new to prototype, javascript and I got many problems
> > > > so please understand my bunch of questions :)
> >
> > > > Here is my question.
> > > > I'd like to replace my div when window resized.
> > > > I coded like below:
> > > > <script>
> > > > function onBodyLoad() {
> > > >     var onResize = function(e) {
> > > >         var viewport = document.viewport.getDimensions();
> > > >         var screen = $('screen');
> > > >         var s_view = screen.getDimensions();
> >
> > > >         screen.style.positon = 'absolute';
> > > >         screen.style.left = (viewport.width - s_view.width)/2+'px';
> > > >         screen.style.top = (viewport.height - s_view.height)/2+'px';
> > > >     };
> >
> > > >     Element.observe(window, 'resize', onResize);};
> >
> > > > </script>
> > > > <body onLoad="new onBodyLoad()">
> >
> > > > I can see onResize was called.
> > > > But IE, viewport.width returns 0, and FF returns right number.
> > > > and both screen element doesn't move its position.
> >
> > > > What's wrong with above code?
> >
> > --
> > Best Regards,
> > Vladimir Tkach
> >
> > +972-54-7574166
> > tea...@gmail.com
> >
> > http://teamco-anthill.blogspot.com/- 원본 텍스트 숨기기 -
> >
> > - 원본 텍스트 보기 -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to