Calling Function Residing On Ancestor Page From Child Page
Dec 13, 2005
I am working on a web application and have run into a problem. From a
main window (Window1) I open a child window (Window2), and from that
child window I open a grandchild window (Window3). I need to call a
funcion that resides on Window1 from Window3. I do this successfully
by calling a function with window.opener on Window3, which calls a
function with window.opener on Window2, which calls a function on
Window1.
My problem comes in with the case of a user closing Window2, and trying
to carry out the function on Window3 that calls the function on Window
1. I have already tried window.top, but it doesnt seem to work.
window.opener of course returns the error "window.opener has no
properties".
I have an iframe inside of a parent page. How do I call the onChange function in the parent page from the ddlProfileNames dropdown in the iframe page? Thanks.
But what I wanted to do is, says I have two pages: page1.html and page2.html, and in page2.html I have a few JS functions namely myFunc1(), myFunc()2 and myFunc3(). Then I am inserting a few links in page1.html with an iframe below all the links with the name="my_frame", and what I want to do now is for the 3 <a> links I want to open up page2.html into the iframe (e.g. <a href="page2.html" target="my_frame">open Func 1</a>) but also when the page is loaded, one of those 3 functions would be invoked correspondingly depending on which link on page1.html I clicked.
Suppose there is a function myFunction() defined in a web page. Now how can a visitor call this function manually, using the JS console or Firebug etc.Is this possible?
I have a JavaScript function defined in the head section of an aspx page.How can I fire this function from the asp.net page_load function when the page loads?
this forum I have managed to write a VB.NET Web Application with several Web Form. this has a JavaScript function (in a seperate .js file) that is called on the click of a button, code used is :-
I am currently trying to figure out some event stuff with Javascript. I have the page capturing all onkeypress events by calling my function keyPress, and passing the event as an argument.
The key presses get passed to a text field that I have on the page (even if it's out of focus at the time of the key press) by using textfield.focus() within my keyPress function. This seems to pass the event along to the text field so that it registers the stroke and handles it as if the field was in focus at the time of the key press.
My problem lies in that I need to then grab the new value of the text field for use with another part of the script. It seems though that with the way I'm setting focus, it'll execute the rest of my keyPress function (with the outdated text field value) before the text field handles the event.
Is there a way to yield the event to this text field first?
Sorry, this was a long post, but I guess here's a short recap: If I handle key presses via the body of the page, so that regardless of the text field's current state of focus it updates the text field accordingly, is there a way to have that happen first before the rest of my function that needs to use the new value of the text field?
I have a simple javascript function loadNPlay('file'),
parent.loadNPlay('file');
on clicke event it simply plays the file in a player in the parent window. with IE and Mozilla its working fine but with Safari, when called from iframe this function doesn't work(it does work, ie loadNPlay(..) when called in the same window, in safari)
I have tried:parent.loacation.loadNPlay(..) as well, it doesn't work.
I have been a mainframe programmer for over 20 years - I have a new project that requires browser pages written in JavaScript. I currently begin with a HTML page that assigns the values retrieved from a third party vendor's API to an array. I pass this array to another page to build a table full of links - when a client clicks on one of the links, two variables are put into yet another array and a third page is called, successfully passing the required data. Ultimately page 1 and page 3 will be .asp pages so that additional third party vendor API's can be called. The problem is this: after the third page is called from the second page, it displays for a second and then returns to the second page. When I click back I can see the third page, followed by the second page, and finally the first page. My question is this: why is the third page not displaying in the browser? I'm sorry if I have not posted this correctly as I really am a mainframe programmer and this is my first time doing anything code related with web pages
I have parent page http://localhost/pc/rep/pc.php after the user enter the customer data, the user will press button to print it
then, call child page via window.open jar:http://localhost/pc/rep/my-ca/script.jar!/test.html
as you can see, they are belong to the same domain.
The user will select the lables that the program will printed, and the numbers of each one.
I don't know, how can I pass the data from child to parents.
parent.opener.document.forms.item(4).txtClaimTicket.value = 1; [permission denied for <http://localhost> to get property window.document from <http://localhost>
I have a sliding vertical menu in my page in the left side and in the right side i have a text say for eg: Home.
So when i click on home, i need the left side vertical menu to slide and open and the home in the left side should get highlighted. How do i do this in javascript?
I have a single webpage that contains information on all 50 U.S. states. There are 50 links at the top to jump down to the state you want, and at the bottom of the information for each state a Back to Top link.
I'm making the Back to Top link into something more complex, and it will require three or four lines of code.
So that I don't have to repeat the code 50 times, and create a burden when I need to edit it, I want to place it in a .js file and call it x. Then below the information for each state I'll simply have:
Does calling code from a .js file 50 times slow down the page load? Which method would load faster?
i do not know much javascript, but i am trying to call several different scripts from the same web page and it is not working. Is there something i can do or is this not a thing that is do-able?
I'm trying to do something simple: find out which page had the link which got me to the current page. I am using window.referrer, in IE6, but it never has anything but blank in it. The scenario is that the user must go though a sign on page to get to the goodies. If they go direct, they get bumped to login:
if (window.referrer != "login_page" { window.location.href = "login_page" }
But the referrer is no present. I've also tried looking at window.history but to no avail. Are these all netscape specific and if so, what is an IE equivalent?
where EnableCheckboxes is a javascript function on the page. This doesn't work (doesn't disable the CheckBoxList), although the EnableCheckboxes function DOES work when I call it in other ways, so I'm sure that the problem is that I'm not calling it properly on page load.
I use this code in a popup to refresh the parent browser. It works fine as long as the user actually clicks on this link but does not work in cases where the user closes the child popup through the Windows X (close) button. Any way to accomodate this also?
I'm trying to access a child iframe from my parent page. Is it possible? I've googled this extensively ut have found only scripts that allow me to communicate from the child iframe to the parent iframe. I want to do it the other way round. I need to be able to get in to the child frame and access it's DOM.
I have to call the script below from my html page. How would I do that? Do I need to modify the script at all? Put in a function that returns the random title to the html page?
I have home page with session close button and 10 child window link and i am opening all child window.All child windows should close after clicking on session close button. Code bellow
i have a page containing an iframe somewhere in the middle of it. the iframe stretche to the end of the page and its height is calculated from its content with javascript.
i want some of the pages i load into the iframe to have a "back to top" link at the bottom. but i can not put the anchor inside my iframe because my iframe doesn't start at the top of the page.
so i put the name linke of the anchor at the top of the parent page which has the iframe inside. but i couldn't find a way to call that anchor from within the iframe.
i'm sure this could be done with a simple code of javascript. how do i get to the parent frame within the iframe?
I got this code from w3schools and I want to alter it for my needs. However I can not get the basic example to work. I have repeatedly cross checked it and can't see any error. I wonder if anyone can spot what I am doing wrong. code...
I am having problems calling a JS function from asp.net code behind button click after some code is ran. The first time the button is clicked and it calls the JSfunction the readyState = loading and it cannot find the element. The second time the button is clicked the readystate is complete and it finds the element.Here is the code behind
I'm having trouble calling javascript functions that are loaded in the main window.
Here's what happens:
- when a link is clicked on my page, the contents of a div are reloaded with new contents from another file.
- The new file only contains the new contents of the div.
- I want the new contents of the div to call a function that was originally loaded before the new contents were reloaded.
- So, the main page loads the information and the javascript functions. Then, when the link is clicked, the new contents are loaded into the div with a link that calls a function that was already loaded.
- However, nothing happens when I click on the link to call the function.
Is there something I need to do to call the function?