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

vertical scrolling in a newly created window

Greetings all,

I'm having a problem with scrolling vertically in a newly created
browser
window. The vertical scrolling is to reach some anchor point within
the new
browser window.

I'm attempting to do this by using an anchor point name of an anchor
located
in the new page as an argument to the JS function opening the new
browser
window. Here's exactly how I'm trying to go about it.

* PageA contains a hyperlink with an onclick event to open a new
page...PageB:
<a href="#" onclick="openPageB( 'someAnchorPoint' ); return false">
where "someAnchorPoint" is the name of an anchor in PageB.

* The JS that I'm using is:
function openPageB( someAnchor )
{
var oNewWin = window.open("/PageB.html", "Help", "width=400,
height=350,
status=no, scrollbars=yes, resizable=yes");
oNewWin.onLoad = window.scrollTo(0, document.anchors[someAnchor]);
oNewWin.focus();
}

My reasoning is based on by belief that document.anchors will return
an integer value based on the geographic location of some given named
anchor within the document object.

What's happening now is that a new browser window is created fine, but
just
can't get the scroll to work; always starts at position 0,0.

Any suggestions are greatly appreciated, and thanks in advance,
yootzee
Jul 20 '05 #1
2 5381
yo*****@hotmail.com (yootzee) writes:
* The JS that I'm using is:
function openPageB( someAnchor )
{
var oNewWin = window.open("/PageB.html", "Help", "width=400,
height=350,
status=no, scrollbars=yes, resizable=yes");
Why not just

var oNewWin = window.open("/PageB.html#"+someAncyhor, "Help", ...
oNewWin.onLoad = window.scrollTo(0, document.anchors[someAnchor]);
I don't know if this will work, but in any case "onload" is with all
small letters.
My reasoning is based on by belief that document.anchors will return
an integer value based on the geographic location of some given named
anchor within the document object.


.... and that is an unfounded belief.

The collection "document.anchors" contains HTML elements (i.e., DOM
nodes). It is browser dependent how to find the horizontal offset of
the element on the page. Methods include:

elem.offsetLeft // IE, Opera, Mozilla,
// but not inside positioned elements
elem.scrollLeft // Opera (bug?)
elem.x // Netscape 4

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
Thanks Lasse, originally, I was using concatination
("PageB.html#"+someAnchor), and it wasn't working. so, my still being
a little young and naive with JS, I just figured window.open didn't
like that. but, after scrutinizing my scripting, I realized that it
was a PEBCAK error. thanks again for the help. yootzee

Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<ek**********@hotpop.com>...
yo*****@hotmail.com (yootzee) writes:
* The JS that I'm using is:
function openPageB( someAnchor )
{
var oNewWin = window.open("/PageB.html", "Help", "width=400,
height=350,
status=no, scrollbars=yes, resizable=yes");


Why not just

var oNewWin = window.open("/PageB.html#"+someAncyhor, "Help", ...
oNewWin.onLoad = window.scrollTo(0, document.anchors[someAnchor]);


I don't know if this will work, but in any case "onload" is with all
small letters.
My reasoning is based on by belief that document.anchors will return
an integer value based on the geographic location of some given named
anchor within the document object.


... and that is an unfounded belief.

The collection "document.anchors" contains HTML elements (i.e., DOM
nodes). It is browser dependent how to find the horizontal offset of
the element on the page. Methods include:

elem.offsetLeft // IE, Opera, Mozilla,
// but not inside positioned elements
elem.scrollLeft // Opera (bug?)
elem.x // Netscape 4

/L

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Midas NDT Sales | last post by:
I have been looking at a simple example of a scrolling text box (the one in the SAM book) as below: <script language="JavaScript"> var pos=100; function Scroll() { if...
2
by: Don Schneider | last post by:
I tried to setup a frameset which consists of 4 different subframes. Each of these subframes should fetch a different web page from the internet and display it completely (!). BUT: the vertical...
2
by: chris | last post by:
hi all, i need to create vertical scrollbar dynamically for the controls that are created dynamically in the form. (i'm not adding any controls to the panel). when the form exceeds(coz of...
7
by: bienwell | last post by:
Hi, I'm using the CheckBoxList control in ASP.NET for Web development. This checkboxlist is bound by the database. If we have more items for this checkbox list, it takes space on the page. I...
2
by: Gene Hubert | last post by:
I'm assigning a new datasource (a datatable) to a datagrid that is aready displayed in a form. Then I assign a new value to CurrentRowIndex. The datagrid always scrolls so that the new current...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
3
by: lolo | last post by:
hello. happy new year. I'm trying to build a website for my wife and she is adament on having a horizontal thumbnail scrolling div. great. I have a good vertical scrolling thing, but can't...
2
by: =?ISO-8859-15?Q?Stefan_Br=FCckner?= | last post by:
Hello NG, I'm looking for an solution to find out the real vertical viewport - without the height of horizontal scrollbars. I have two frames side by side. The left one declared...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.