Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > vertical scrolling in a newly created window

Reply
Thread Tools

vertical scrolling in a newly created window

 
 
yootzee
Guest
Posts: n/a
 
      10-16-2003
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
 
Reply With Quote
 
 
 
 
Lasse Reichstein Nielsen
Guest
Posts: n/a
 
      10-16-2003
http://www.velocityreviews.com/forums/(E-Mail Removed) (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 - (E-Mail Removed)
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
 
Reply With Quote
 
 
 
 
yootzee
Guest
Posts: n/a
 
      10-16-2003
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 <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> (E-Mail Removed) (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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open newly created HTML page in new window? mcmwhite@hotmail.com ASP .Net 1 05-31-2006 08:17 PM
Error Debubbing newly created ASP.NET Project =?Utf-8?B?bWN3b29x?= ASP .Net 4 11-15-2005 02:15 AM
Importing a list of existing addresses into a newly created "List" Dan Firefox 2 05-10-2005 07:50 PM
Get newly created record's ID?? David Lozzi ASP .Net 1 12-07-2004 04:23 PM
Newly Created Image Not Always Found by Following Code Earl Teigrob ASP .Net 0 08-05-2003 03:39 PM



Advertisments