473,382 Members | 1,329 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.

Clicking a button on an iframe

I've got an ASPX page with an iframe that has another ASPX page. When the "Next" button is clicked on the main page, I want it to click the "Save" html input button on the iframe page. On the back end of the main page, I have the following line:

btnNext.Attributes.Add("onClick", "window.frames[0].document.getElementById('btnSave').click();")

This works fine in IE. It also works fine in FireFox if I add a window.alert after the click. Without the window.alert, it doesn't work in FireFox. What am I missing?
Feb 8 '08 #1
2 2735
Follow up on this: It appears that it is running the code on the main page first, instead of the clicked button on the iframe. The main page has code on the backend to verify that the work in the iframe has been done first. It seems that IE is running the iframe first, but FireFox does not. How do I make FireFox handle it like IE does?
Feb 9 '08 #2
Well, it appears that IE will process a javascript click of a button on an iframe and then code running on the main page whereas Firefox does the opposite. To fix this, I did the following code:


window.frames[0].document.getElementById('btnSave').click(); setTimeout('document.getElementById(\'ctl00_Conten tPlaceHolder1_btnMainSave\').click()', 250);

This forces Firefox to wait on the main document code, giving it time to run the iframe code. Hopefully, if this affects anyone else, they'll find this post.
Feb 9 '08 #3

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

Similar topics

12
by: Javier | last post by:
Hello, I'm very new in this forum and as I have the following problem, the website is in http://new.vanara.com ----------------------------------------------------------------------------...
4
by: PiedmontBiz | last post by:
Greetings I have written an online survey with 110 questions. I use javascript to cycle thru all the questions which are displayed in an iframe. I keep track of the question number using a...
8
by: Rose Chambers | last post by:
How can I insert preformatted text from a file on the web server into a table's cell? And then swapped the text in response to an onClick event. Something like this......... <table>...
4
by: Net | last post by:
Hi, In my web page instead of the users clicking on a link to another site I want that site be shown on the same page. Can any one help with this example. I tried iframe but it also shows a...
10
by: Jim Bayers | last post by:
We need to stop students from clicking on the form button more than once. We have a form that students fill out with their credit card information. They click, the form sends the data in xml to...
1
by: sheldongold | last post by:
Hi, I've got a dropdown list of products and I have a button that will add the product to my cart. However, as with all my 'add to cart' buttons, when the user clicks it I want to pass the...
7
by: Bon | last post by:
Dear all I create a master page with image buttons on the left-hand side for navigation. When a user clicks the student button, the content (i.e. ContentPlaceholder) in masterpage will be...
1
by: louvino | last post by:
Hi, I have a button. When I click on this button, a menu in a iframe appears. I can't put the code of the iframe in the same div. I would like that : if I do a "mouseout" of the button and...
3
by: friday13 | last post by:
Hi, I would like to set the link's "visited" pseudo-class with javascript without clicking on the link. My goal is to update the link's color (previously set in the CSS file) to be "visited"...
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
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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.