Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 06-08-2009
Member
 
Join Date: Jan 2009
Posts: 74
Passing variables using iframes

I am facing some issue where i need to pass another variable into the iframe like the others (var, vartwo, varthree) and I don't want to have that variable until there is JavaScript function to extract a background color from a div tag. Basically, I have to pass a bgcolor into the iframe so the resulting page will then display itself with a color that matches the parent page.
Reply With Quote
  #2  
Old 07-08-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Passing variables using iframes

In that case you need to pass your bgcolor into the iframe so that the page will then display itself with a color that matches the parent page. Normally it's backend process and it need to have backcolor= where it will be appended to iframe. Try to use the below code

Code:
document.getElementById('IframeID').contentDocument.body.style.background = document.body.style.background;
Reply With Quote
  #3  
Old 07-08-2009
Member
 
Join Date: Jan 2009
Posts: 74
iframe variable

I have try to do that too but it's still facing same issue. I am trying the below code and can anyone tell me where i am going wrong.
HTML Code:
<body>
<form name="form" method="post" action="">

<input type="text" name="text_field" />
<input type="button" name="button" name="button"
onclick="parent.frames['myIframe'].document.form1.textfield.value=
this.form.text_field.value"/>
</form>
<p>
<iframe name="myIframe" src="iframe_page.htm"</p>
</body>

<script type="text/javascript">
{
var x=document.getElementById("form1").textfield.value
alert(x)
}
</script>
<body>
<form name="frame1" method="post">
<input type="text" name="textfield" onclick="show()"/>

</form>
</body>
Reply With Quote
  #4  
Old 07-08-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Pass variables using iframes

Try to use the below code and i am sure you would be able to pass variables using iframes.

HTML Code:
<script type="text/javascript">
var copying = false;

function copy(form_Name, from_Name, frame_Name, frameFormName, toName) {
if(!copying) return;
var to = window.frames[frame_Name].document.forms[frameFormName].elements[toName],
from = document.forms[form_Name].elements[from_Name];
to.value = from.value;
window.setTimeout(function() { copy(formNum, from_Name, frame_Name, frameFormName, toName); }, 300);
}

function beginCopy(form_Name, from_Name, frame_Name, frameFormName, toName) {
copying = true;
copy(formNum, from_Name, frame_Name, frameFormName, toName);
}

function endCopy() {
copying = false;
}
</script>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Passing variables using iframes"
Thread Thread Starter Forum Replies Last Post
Will using iFrames hurts SEO Weeraz Software Development 7 21-02-2012 07:42 AM
Problem of iframes Hashim Software Development 3 21-11-2009 08:19 PM
How to use $_GET in iframes BansiJ Software Development 2 26-08-2009 09:54 PM
Passing variables from one page to another In PHP kaartik Software Development 2 24-01-2009 09:28 PM
Passing variables in SQL Query Braze Software Development 2 01-01-2009 08:52 PM


All times are GMT +5.5. The time now is 05:18 AM.