473,382 Members | 1,717 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,382 software developers and data experts.

Javascript, window.opener.location.href with anchor doesn't actually refresh

To set this up, I have a parent window with a list of things (doesn't matter what they are, but they are loaded by the page dynamically from a database with ASP server-side script. So, next to each item is an EDIT link that opens up a child window, sending it a REQUEST object with a value that helps the window look up some things about the list item in the database that the web user can then edit in a form and, of course, submit. Finally, and where the problem code is, there is the script-only page that the windowed form submits to. On that page, I do some database updating (server-side first, then my "HTML" (although the browser doesn't actually render anything, really) is:
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <body onload="window.opener.location.href='ParentListPage.asp#12';self.close();">
  3. </body>
  4. </html>
...the problem is that without the anchor name (#12), this script works great; refreshes the parent window and auto-closes the window (this, of course, happens immediately when the user clicks the SUBMIT button on the windowed form, which is pretty cool/smooth). With the anchor, the parent window does indeed scrool down to the provided anchor, but the parent window still has the old (outdated) information - it's not re-querying the server, which is important for me in this case.

Anyone know why I can't have an anchor here?
Sep 21 '07 #1
2 13828
pbmods
5,821 Expert 4TB
Heya, TheITGuyFromNY. Welcome to TSDN!

Please use CODE tags when posting source code:

[CODE=html]
HTML code goes here.
[/CODE]
Sep 21 '07 #2
The anchor is supposed to allow someone to get to certain part of a page quickly without having the page reload. This is why the page doesn't reload with an anchor. You can still use javascript to complete this the long way by adding this code into ParentListPage.asp:

Expand|Select|Wrap|Line Numbers
  1. <script type='text/javascript'>
  2. var ancor=location.search;
  3.  if(ancor != null && ancor.indexOf("=") > 1)
  4.  {
  5.    window.location.href="#"+parseInt(ancor);
  6.  }
  7. </script>
  8.  
And change the onload of the other page to:
Expand|Select|Wrap|Line Numbers
  1. "window.opener.location.href='ParentListPage.asp?a=12';self.close();"
  2.  
I hope I helped!
Sep 22 '07 #3

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

Similar topics

6
by: Shaun Fleming | last post by:
I've been trying to make this simple script compatible across various browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I have version 7.11). This is what is supposed to happen:...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
4
by: JPL Verhey | last post by:
Hi, I have a little test script in a pop up window. The pop up page refreshes every 2 seconds. I want it to check with every refresh if a certain page (log3.htm) is loaded in the opener window....
14
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
1
by: Leon | last post by:
From parent windows, I have created a popup windows that comprises two frames. When I have clicked a link button in one of the frames, I would like to redirect the parent windows to somewhere. So...
9
by: tshad | last post by:
This is from my previous post, but a different issue. I have the following Javascript routine that opens a popup page, but doesn't seem to work if called from an asp.net button. It seems to work...
4
by: Matt Jensen | last post by:
Howdy all Hopefully I can explain my problem straightforwardly. In it's simplest explanation, what I want to do is have a hyperlink that, when clicked, executes some client side JavaScript and...
5
by: soni2926 | last post by:
Hi, I have a pop up window, that window needs to refresh the parent window when opened, I'm doing the following: window.opener.location.href(window.opener.location.href); problem I'm having...
1
by: KRISHNA PRAVI | last post by:
the error is "runtime error object expected" here is the code....................................................................................... <script language="javascript"...
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...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.