473,837 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

88 New Member
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 10850
dmjpro
2,476 Top Contributor
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
ManWithNoName
88 New Member
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
ManWithNoName
88 New Member
... How do I mark this thread resolved?
Aug 28 '07 #4
dmjpro
2,476 Top Contributor
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 Misunderstandin g your Problem.
Anyway I also tried but the second one is problem.


Kind regards,
Dmjpro.
Aug 28 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
... 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
ManWithNoName
88 New Member
Sorry for Misunderstandin g 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 Top Contributor
... How do I mark this thread resolved?
And what's the Solution?

Kind regards,
Dmjpro.
Aug 28 '07 #8
acoder
16,027 Recognized Expert Moderator MVP
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
ManWithNoName
88 New Member
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

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

Similar topics

1
1871
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 of weather maps. I've unsuccessfully tried to modify slideshow22.html to automate the function clickScroll(), which executes scrollTo(x,y), which manually works just fine when invoked by the "Click to Scroll" button. Simple-mindedly, I tried to...
4
13770
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 onload="goToPosition()">
1
3356
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 Spanish:',''))};if(Qr){window.setTimeout('x.focus()',500);void(x=window.open('http://www.wordreference.com/es/translation.asp?v=pop&tranword='+escape(Qr),'WordReference','width=600,height=600,left=800,top=0,resizable=yes,scrollbars=yes'));void(x.scrollTo(300,400))} or summarized: javascript: ... ...
15
3172
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, of course). <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Language" content="en-us" />
1
2429
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; defenition ---------- function sstchur_SmartScroller_Scroll() {
1
1725
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 transitional doctype, the js script no longer works. Can someone familiar with javascript bring it up-to-date so that it works with current doctypes and post it here for others to make use of? The whole HTML document including the js scrip follows (...
0
9830
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9682
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10615
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10263
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9390
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7803
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6989
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5664
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4036
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.