| Author |
how to change url of iframe in javascript
|
alsoumahi alBatal
Ranch Hand
Joined: Nov 22, 2009
Posts: 84
|
|
Hi experts , I am just having a problem that I couldn't change the url of iframe in function of java script , how I could that ??
I have tried other ways but got errors !!! . the iframe is in parent page inside form, based on user action such as click button I want to change the url of iframe so other
pages should appear instead of the one was before .
I have tried this couldn't do it , please help me
I have tried this:
var form = document.forms[0];
var iframeElement = form.elements["Iframe1"];
iframeElement.location.href= "/QC/alertWebForJoint.jsp"
I have tried this:
var iframeElement = document.getElementById('Iframe1');
iframeElement.location.href= "/QC/alertWebForJoint.jsp";
I have tried this:
var iframeElement = parent.document.getElementById('Iframe1');
iframeElement.style.src="/QC/alertWebForJoint.jsp";
what shall I do to change url of iframe , although iframe is inside form??
thaaaaaaaaaanks a lot guys in advance
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
iframeElement.style.src="/QC/alertWebForJoint.jsp";
Why on earth would you expect the src property to be inside the style property?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
alsoumahi alBatal
Ranch Hand
Joined: Nov 22, 2009
Posts: 84
|
|
Bear Bibeault wrote:
iframeElement.style.src="/QC/alertWebForJoint.jsp";
Why on earth would you expect the src property to be inside the style property?
becuase I saw one example show me that for the hight not src , I said just to try !!!
please help me how to solve this
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
Trying random things is never likely to work.
Get yourself a good reference and actually look up the properties of an iframe and stop randomly guessing.
|
 |
alsoumahi alBatal
Ranch Hand
Joined: Nov 22, 2009
Posts: 84
|
|
Bear Bibeault wrote:Trying random things is never likely to work.
Get yourself a good reference and actually look up the properties of an iframe and stop randomly guessing.
thanks bro , but I have tried at least , do you know what to do now , I need a solution.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56221
|
|
|
I am not your bro. I am not your lackey. And I am not your substitute for a reference.
|
 |
 |
|
|
subject: how to change url of iframe in javascript
|
|
|