473,657 Members | 2,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Q: location.href change & scrollBy problem

JF
Hi,

I need to change the location of the parent window and after
that scroll a little bit (because of "position:fixed " css buttons,
which obscure the title).

I have
window.opener.l ocation.href = "newhreflab el";
window.opener.s crollBy(0, -25);

The newhreflabel may point to the same document or load
a new one (another chapter).

There is a problem is with timing, T think I need to
serialize those two instructions.

However, the window.opener.d ocument.onload does not seem to
be trigered by href change. Is there any other way how to
do it - or I have ti all wrong?

Thanks
Josef
Jul 23 '05 #1
1 2161
JF <jf***@ics.muni .cz> wrote:
I need to change the location of the parent window and after
that scroll a little bit (because of "position:fixed " css buttons,
which obscure the title).
I have
window.opener.l ocation.href = "newhreflab el";
window.opener.s crollBy(0, -25);
The newhreflabel may point to the same document or load
a new one (another chapter).
There is a problem is with timing, T think I need to
serialize those two instructions.
However, the window.opener.d ocument.onload does not seem to
be trigered by href change. Is there any other way how to
do it - or I have ti all wrong?


One approach could be to use anchors in your documents.

In your 'body.htm' file:

<a name="myanchor" >...</a>

Then in your 'contents.htm' file:

window.opener.l ocation.href = "body.htm#myanc hor";

To reload to another document, you can use:

window.opener.l ocation.href = "otherdocument. htm";
or
window.opener.l ocation.href = "otherdocument. htm#otheranchor ";

It 's not strictly necessary (though maybe better practice) that this
code goes inside <body onLoad="...">. Just putting it in a <script>
section should do it as well.

A change of XXX.location.hr ef could be called from 'body.htm' as well
as from 'contents.htm' as long as they reside on the same domain.

--
Bart
Jul 23 '05 #2

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

Similar topics

4
8815
by: Mark Anderson | last post by:
Sorry if this is a rookie mistake... I've been through all the FAQs and the books I have but I can't see the mistake so I guess it's something simple <g> - I'm an occasional JS user. I've got some code (in an external JS file) attached to a number of links off a query result page. The code it checks if there are any ticked items on the page and adds them to a lightbox (cart) before going the next called result page. The idea is to stop...
4
6856
by: Max of Mad | last post by:
Hi all, I wrote this a while back, but I was unable to get it to work for mozilla. Looked all over the place, but could not find anything on why. Basically, this has a dropdown of some search engines, and a text input for the search term. Click GO and it takes you to the selected search engine with the query. This works great on IE and Opera, but it will not work in Mozilla. My
1
3465
by: Bryan | last post by:
Hi, I have a form that I want to click a button on and cause the location.href to change. this is what I used: the function: function testform(){ location.href="http://www.google.com" }
8
8219
by: Phil Powell | last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href = document.location.href.substring(0, document.location.href.indexOf('?')); if (document.location.href.indexOf('#') >= 0) { document.location.href = document.location.href.substring(0, document.location.href.indexOf('#')) + '?' + newUrl; } else { document.location.href = document.location.href + '?' + newUrl; }
2
4983
by: your name here | last post by:
I've been trying to get the scrollby javascript feature to scroll through frames. My end goal is to make my own scroll buttons to use for navigation through the frame but I figured I would start simple. I would load a frameset and just move the correct frame by 100 pixels right and 100 pixels down. Here is the code I am using: <html> <script TYPE="text/javascript"> function scrollme()
3
22992
by: Christian Hubinger | last post by:
Hi! I'm working on a page that uses javascript very much. My problem is now that i cannot redirect to another page in IE with window.location =<URL>; This command gets executed (proofed with alert messages) but nothing happens. FF acts like expected but i cant get it work in IE. What can be the problem here? here the code i use:
4
1735
by: tsreyb | last post by:
Is there an HREF anchor construct that allows me to instruct the browser to start the display from the document's end? I do not have the access to the the referred document, hence I cannot insert a # anchor at its end. Hoping for something like href a="ABC.html#_END_" where _END_ would be some sort of special syntax rather than a user-created anchor in the document. thanks,
6
2882
by: G*rd*n | last post by:
I have been using the HTTP "Location" reponse header to direct a symbolic request to a CGI program to an actual URL/file. For example, let us suppose the CGI program's table indicates xyz -> /this/that/the.other.thing.html, then redirect.cgi?xyz results in the page /this/that... being sent. redirect.cgi is usually in another directory than the page it is to supply. This works fine as far as it goes. A problem arises when the actual...
1
4487
by: michal.podlewski | last post by:
Hi All, I have a problem with a simple (as I thought till now) thing: I want to make a link in a child-window which would change site in the parent-window and along with closing child window. The parent window name is "main". A made a link like this in the child-site: <a href="new_address.html" target="main" class="about" onclick="javascript:main.location='new_address.html';self.close();"> change and close </a>
0
8407
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
8837
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7347
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...
0
5638
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
4171
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...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1969
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.