I'm new to JavaScript and i have hit a slight problem with a project. basically, my issue is with iFrames - in particular, passing a value from an iframe to the parent page. i am trying to find a way for to pass the url of an iframe source back to the parent. hardcoding the source, or using a form within the iframe is ok - however i want to be able to view any page on the web within the frame, and for the parent page to be bale to identify what url is being loaded within it.
I have a parent page containing an iframe. The parent page has a menu in it which opens links in the iframe. I want to highlight different bits of the menu according to which page has loaded in the iframe.
So I would like to do something like this:
1. Use PHP to extract the file name (minus 'php' at the end, of the page loaded within the iframe (which I can do fine).
2. Use javascript onload so that the iframe sends this value (say 'pagename') to the parent page when it loads any page in the iframe.
3. The parent page, having received that variable into its header, will adjust a line of css to something like: .pagename {background-color:red;}
And so the menu link for pagename.php will be colored red
4. When pagename1.php is loaded into the iframe, that will send 'pagename1' to the parent page, change the CSS in the head, and therefore change the highlighted menu item from pagename to pagename1
Is this possible? And easy? There seems to be a lot of stuff online about moving variables from iframes, but mainly in the context of form entries from an iframe to a parent, eg here:
[URL]
parent.function_name(); seems to be needed along the way. But I am not sure how to proceed.
To sum up this issue, I have a parent page, which holds some values in hidden input fields passed to them from the url. On this page, I have an iframe with a form in it, to which I want to pass values from these hidden fields to be displayed for the user in the iframe form. In IE, it works. To accomplish this, im just simply doing a <body onload="GetInput()">. The GetInput function does the following, but for about 10 fields:
Fnamefield=document.getElementById('firstname').value = parent.document.getElementById('firstname').value; Thats it. Once the page loads, i see my values. In firefox it does not work. I know the hidden fields are getting their values, but thats as far as it makes it. I have tried calling the GetInput function after the form is written out and not in the body tag, which still works for IE, but not FF.
I have an webbpage, and in the middle of it there is an iframe to a php site. So i have used this code, so after some seconds the iframe will send the guest to another page. <meta http-equiv="refresh" traget="_top" content="5 url=http://mypage.com"/> But the thing is that i want the WHOLE page to reload, and go to that page after 5 seconds (we can say). With that code, only the iframe are going to another page. Is it possible to make the whole page send the user after some seconds, to another page and not only the iframe?
how do I pass url value to iFrame inside the same page, for example: I would like to pass [URL] to iFrame where is the function displaying all the items with value = 1. This is all on the same page.
I'm working on a upload script that uses javascript, and a hidden iframe to upload the files. It all works up until the iframe finishes and needs to send the javascript function call back to the parent page, nothing happens, when it should hide the upload progress bar. I've searched and searched for the answer, along with trying different alternative to window.top.window, such as window.top, parent, and parent.document and so far nothing has worked, I've even tried the onLoad on the iframe with no success.
Parent Page function: function stopUpload(success, ups, file){ var result = ''; var uploaded = '0'; if (success == 1){ result = '<span class="msg">The file was uploaded successfully!</span><br>'; uploaded = uploaded ++; if (uploaded == document.getElementById('numflowers').value){ document.getElementById(finish).style.display = 'block'; ..... }} else if (success == 2){ result = '<span class="msg">There was an error during file upload! The file has a size of 0</span><br> File: <input name="ufile[]" id="ufile[]" type="file" size="30"> <input type="submit" name="submitBtn" value="Upload">'; }else if (success == 3){ result = '<span class="msg"> We only allow .png, .jpg, .gif, .zip, .rar, and .7z files to be uploaded. If you think we should allow other please make a suggestion on the forums.</span><br> File: <input name="ufile[]" id="ufile[]" type="file" size="30"> <input type="submit" name="submitBtn" value="Upload">'; } var uploadp = "upload_process" + ups; var uploadf = "upload_form" + ups; document.getElementById('uploadp').style.display = 'none'; document.getElementById('uploadf').innerHTML = 'result'; document.getElementById('uploadf').style.display = 'block'; } Function call inside iframe (example) window.top.window.stopUpload(3, 1, test.txt)
My main browser page has an iframe. Whenever the iframe is reloaded (updated), I want to automatically refresh the main webpage as well. How can this be done, preferably using javascript?
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?
My site has a menu + iframe layout. Clicking on the menu link loads a page in the iframe. The iframe is set to a specified dimension.
I only have a single page that loads in the iframe. Clicking on the menu link loads a specific section on the page using the name anchor. The specified dimension of the iframe allows for the selected info to be visible.
I can create a new page for every link, but to the site's nature (its like a catalogue), I rather have it on a single page and have it called by the name anchor. I am trying to set it so that every time a menu link is clicked, the single page refreshes itself, and then goes to the anchored location. I need this for a reason.
I have tried many things but I have not got it working.
I have an instance where I do some work in a page contained in an iframe and then need to either outright move or just copy the resulting page elements into the parent page. All of the back end stuff works fine, but the Javascript just runs and doesn't produce anything. The script in question:
Code: var AddressListDiv = parent.document.getElementById("AddressListDiv"); var ListPanel = document.getElementById("ListPanel"); for(var LPC = 0; LPC < ListPanel.childNodes.length; LPC++) {
[Code]....
I think I'm running into a restriction in Javascript, but I'm not 100% sure.
On my homepage (index.html), I have a search field which fires the users input (text) parameters off to another website to perform the search (ie. results.html). What I'm now trying to do is create an iframe on index.html which shows the search results on the same page (without the user having to visit the other website. Does anyone know if this is possible using javascript?
The reason behind this is so that we can use the search on our old website on our new one... without having to re-invent the wheel.
I would like to have a main form (written in PHP) that has a "lookup" button next to a text field. When the user clicks "lookup", it should open a new window that lets them search (child.page1). When they enter a name or DOB into the search form, it submits the form through PHP (via POST), to a results page (child.page2). This displays all persons in the database which have a name or DOB == to the search term(s), with a checkbox next to each match. They click the checkbox (or alternenatively, a link), and return the checkbox value to the main window.
I have everything working right now, except that (child.page2) doesn't recognize the main window. If the data is entered on (child.page1), it works fine. I'm not very familiar with javascript.. is this even possible? I've considered using frames, to keep the parent-child relationship evident to the computer, but figured I'd check to see if there's an easier way.
I have a page A and inside it I have an iframe B. B points to another php file that shows a form (so basically in the iframe we see a form). When I submit the form, I call to another page C that verifies the fields of the form and if they are ok I redirect to page X, if not I redirect to page Y. The problem is that I see page X and Y inside the iframe, and I want to see them in the parent page.
I have a page which has a form and also one iframe in the same. there is a button on the parent form.when the button is clicked, i am submitting the iframe and parent both. forms are getting submitted. but when i do print_r for iframe values, it is blank
All three values are received at the JavaScript function. Have problems in translating and passing it to the parent. Trying to do the following from popup
I have a script that opens up another window and a task gets executed, all of that is fine, but is there anyway that the parent window (the window that gets open) can pass data to the window that opened it? (I pretty much want to enable a button on that page)
I have a parent page who allows user to view an invoice for service. My page bases the date and the value for payment to <%now%> and to <%total_price%>. However I'd like to permit for users to editing those two fields by opeing a popup window with a new form and asking for these two new inputs. Afterward off corse, this values need to populate the equivalent fields on the parent page.
My questions: 1)I'm opening the new window after a js confirm instead of href or onclick methods, so I don't know how to pass the parent variable ID to the child window..
The code: if (confirmation) {return true;}else{popupwindow("invoice_editing.asp?ID="id"");}
Problem: the parentID=request.querystring ("ID") don't work
2)My child window picks the new values from the form... but I don know how to pass back the new values to the parent page and then reload it..
Please, but as much specific as you can to my problems and also please put the whole code of proposed solution, since I'm totally lost.
i have a form that will pass the value of a child window listbox choices to a parent window, and also the hidden value (via a variable) of the choices in the child window listbox will appears also in the parent window textbox when i hit the submit button in the child window, and the values of the listbox are taken from a acess database, the form works very well, except when i added the following line to my child window: PHP Code:
the hidden value in the listbox of child window wont appear in the textbox in the parent window, when i added the above line.
the above line function as a filtering to my list in the child window, and it is the main part of my code. when i removed the above line, the passing of values to parent window will works fine, except that the filtering function will not work anymore, but i want it both to work, but have no luck. Code: