473,405 Members | 2,294 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,405 software developers and data experts.

scrollTo(x,y) problem; doesn't work with window.onload

This is my first post, so be gentle.

This:

Expand|Select|Wrap|Line Numbers
  1. <body onload="window.scrollTo(x,y)">
Works fine.

This:

Expand|Select|Wrap|Line Numbers
  1. window.onload = function() { window.scrollTo(x,y) }
Doesn't work at all.

Why?
Aug 28 '07 #1
18 10815
dmjpro
2,476 2GB
This is my first post, so be gentle.

This:

Expand|Select|Wrap|Line Numbers
  1. <body onload="window.scrollTo(x,y)">
Works fine.

This:

Expand|Select|Wrap|Line Numbers
  1. window.onload = function() { window.scrollTo(x,y) }
Doesn't work at all.

Why?
Welcome to TSDN.
What is x and y in the first expression.
Expand|Select|Wrap|Line Numbers
  1. <form onload = "window.scrollTo(x,y)">
  2. <!--Here x and y would be number just you using variables-->
  3.  
You got my point?

Kind regards,
Dmjpro.
Aug 28 '07 #2
Welcome to TSDN.
Thanks for the warm welcome.

What is x and y in the first expression.
0,50

You got my point?
Actually... No. :)

Well, it's not important any more. It works now, I do not know why, the code is exactly the same. This. Is. Soooo. Annoying.

This is related to a more advanced XhttpRequest situation, I thought I had isolated the problem to this (window.onload Vs. body onload) but it's seems that I was to hasty in my judgement.

I need to do some further testing to see where the problem is located...

Anyhow, thanks for your input.
Aug 28 '07 #3
... How do I mark this thread resolved?
Aug 28 '07 #4
dmjpro
2,476 2GB
Welcome to TSDN.
Thanks for the warm welcome.

What is x and y in the first expression.
0,50

You got my point?
Actually... No. :)

Well, it's not important any more. It works now, I do not know why, the code is exactly the same. This. Is. Soooo. Annoying.

This is related to a more advanced XhttpRequest situation, I thought I had isolated the problem to this (window.onload Vs. body onload) but it's seems that I was to hasty in my judgement.

I need to do some further testing to see where the problem is located...

Anyhow, thanks for your input.
Sorry for Misunderstanding your Problem.
Anyway I also tried but the second one is problem.


Kind regards,
Dmjpro.
Aug 28 '07 #5
acoder
16,027 Expert Mod 8TB
... How do I mark this thread resolved?
There's nothing in place to do that yet (and may never be because of possible problems).
Aug 28 '07 #6
Sorry for Misunderstanding your Problem.
Anyway I also tried but the second one is problem.


That's OK, most of my problems are weird, thanks for trying.

()()()()()()()()()()()()()()()()()()()()()()()()() ()()()()()()()()()()()()()()()()()()()()()()()()

There's nothing in place to do that yet (and may never be because of possible problems).
I'm almost afraid to ask... But "possible problems"?.
Aug 28 '07 #7
dmjpro
2,476 2GB
... How do I mark this thread resolved?
And what's the Solution?

Kind regards,
Dmjpro.
Aug 28 '07 #8
acoder
16,027 Expert Mod 8TB
I'm almost afraid to ask... But "possible problems"?.
Well, you're good enough to say that your problem is resolved and want to mark it as such. Most don't. In fact, they might just disappear. That would then be up to the moderator to decide whether a question is resolved or not which is subjective. In this way, we could have a lot of unresolved questions. It also means more work for the mods.
Aug 28 '07 #9
I think I have isolated the problem now...

It seems to be a CSS issue (when CSS is removed it works as should).

Looking into to it...
Aug 28 '07 #10
And what's the Solution?

Kind regards,
Dmjpro.
The solution is that there isn't any problem with the window.onload function.
Aug 28 '07 #11
Well, you're good enough to say that your problem is resolved and want to mark it as such. Most don't. In fact, they might just disappear. That would then be up to the moderator to decide whether a question is resolved or not which is subjective. In this way, we could have a lot of unresolved questions. It also means more work for the mods.
(Ops, I accidentally pushed the report button when I wanted to press reply, I hope that I didn't cause any problems (I quickly stopped the submit process))

I see... There is however a certain satisfaction in being able to put a "you won't be hunting me in my restless dreams now-stamp" on your question.

I suppose I just got domesticated in forums using such a function...

Btw, suggestion for your forum: move the report button away from the reply button. Besides for the problem of mistakenly pushing it (I wonder who would do such a stupid mistake, anyway) it kind of feels a little bit tempting...
Aug 28 '07 #12
acoder
16,027 Expert Mod 8TB
(Ops, I accidentally pushed the report button when I wanted to press reply, I hope that I didn't cause any problems (I quickly stopped the submit process))
No, as long as you didn't submit, it's fine.
I see... There is however a certain satisfaction in being able to put a "you won't be hunting me in my restless dreams now-stamp" on your question.
I guess there is! There's pros and cons to this; you never know, it may well be added in the future.
Btw, suggestion for your forum: move the report button away from the reply button. Besides for the problem of mistakenly pushing it (I wonder who would do such a stupid mistake, anyway) it kind of feels a little be tempting...
Yes, this has already been suggested and I agree. Add any more suggestions and comments in the Feedback forum.
Aug 28 '07 #13
Add any more suggestions and comments in the Feedback forum.
Got you.

========================================

Anyway, like I said: I found what the problem was and have started a new thread.

The solution to this thread was that here simply wasn't anything wrong with window.onload scrollTo.
Aug 28 '07 #14
pbmods
5,821 Expert 4TB
Heya, NoName.

Did you mean document.unload?

My guess is that window.unload() doesn't fire until the current document has been unloaded, which would mean that there's nothing to scroll to.
Aug 28 '07 #15
pbmods:

"My guess is that window.unload() doesn't fire until the ..."

Yeah, well my guess is that none of ya seem to know what yer talkin' about. For example, there is no event "unload" -- it's onUnload.

As for the rest of the thread -- what a lot of noise signifying very little. How about addressing the original problem -- why does scrollTo() fail sometime?
Apr 8 '10 #16
Dormilich
8,658 Expert Mod 8TB
@roricka
/facepalm

@roricka
so you solve that three year old thread immediately?
Apr 8 '10 #17
Touche. Yes, it's an oldie, but goodie. No, seriously, I came here because I found this on google, and it was a problem I was having as well. But I was disappointed that really, nobody seemed to address the original issue, and the whole discussion devolved into a bunch of mindless twaddle. But you are right, it was probably not helpful to drop in from nowhere and criticize. On its merits, though, did you think my criticism was valid?
Apr 12 '10 #18
Dormilich
8,658 Expert Mod 8TB
@roricka
As far as I can see, the issue was correctly dealt with in the first posts. admittedly, later the discussion went over to forum matters unrelated to the problem.

@roricka
partly. the unnecessary part was about the event (as you might have guessed from my reaction). you can safely assume, that the Experts/Moderators have enough experience to know the basics. and Event handling, albeit basic, has its malices (IE and its non-standard event implementation comes to mind).
Apr 12 '10 #19

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bob Kistler | last post by:
I have a webpage, http://wwwt.emc.ncep.noaa.gov/gmb/bkistler/javascript/ncep_maps22.html with two frames, an upper frame1 with controls,(slideshow22.html) and a lower, frame2, for displaying images...
4
by: KathyB | last post by:
I have the following script in an html page: function goToPosition() { varGoTo = document.write(document.cookie("Position")); document.scrollTo(0, varGoTo); } </head> <body...
1
by: heken | last post by:
I have this code embedded in a Firefox bookmark: javascript:Qr=document.getSelection();if(!Qr){void(Qr=prompt('Translate to...
15
by: cssExp | last post by:
hello, Rather than going on a wild explanation on what's the the problem, it'll be much quicker and easier if i let you look at it yourself, so I'll post my page source (actual contents taken out,...
1
by: mvmashraf | last post by:
Hai ------------------- In my asp.net page on the onload event i had write a java script function to record the scroll value of browser. window.onload = sstchur_SmartScroller_Scroll; ...
1
by: rfr | last post by:
Apparently the Transitional Doctype kills this script because the script does not make proper use of units like "px". It works well without a doctype statement. But once someone adds a...
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?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.