not able to get output

S

Sukalyan

Hi!,
I am trying to use js.
What I trying to do is that:
I have a text box, below/under that I use a IFRAME.
On IFRAME I have some rows of data.

Now I trying that when I click any one row or name of the IFRAME that
name / row data will come to text box,

on TEXT part I use [form name-- newnew]:
<b>Name:</b></td><td><input name="name1" type="text" size="34"
maxlength="33" onkeyup="showname(this.value)">

on IFRAME part I use:
<iframe name="test" align="top" frameborder="0" src ="./xyz.php"
width="250" height="55" scrolling="auto" marginheight="0"
marginwidth="0" onclick="seltxt(this.value)">
</iframe>


on JS part I use:
function seltxt(str)
{
document.iframe.getElementById("test")=document.form["newnew"].getElementById('name1').value
}
 
T

theCancerus

for accessing an element of main frame in iframe you need to use
"parent"
<input type='text' id='name1' >
something like
parent.document.form["newnew"].getElementById('name1').value to access
the textbox.

also in your code you have missed the ID attribute in input tag without
that "getElementById" won't work. same goes for IFrame also
 
R

Richard Cornford

theCancerus said:
for accessing an element of main frame in iframe you need to use
"parent"
<input type='text' id='name1' >
something like
parent.document.form["newnew"].getElementById('name1').value to access
the textbox.

also in your code you have missed the ID attribute in input tag without
that "getElementById" won't work. same goes for IFrame also

Trying to call - getElementById - as a method of a form element is
going to error anyway as it is only a method of documents.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top