Click to See Complete Forum and Search --> : IFrame 2 input


Zor
12-28-2002, 06:48 AM
I have a big problem. I want to copy the content of an iframe-object to a value of a hidden input-object in my formular. So that i am able to send it by clicking on on an submit button. Is that possible with JavaScript? I tried to get the value by

iFrame.document.value

but it is not defined. Somebody got an idea???

khalidali63
12-28-2002, 09:56 AM
sounds like it should work,follow this pattern

iframe.document.object.value

Khalid

Zor
12-28-2002, 10:28 AM
Nothing works! When i call iframe.document.value in an alertbox, the value is undefined. Pleeeease help me - what´s the correct object to get the information which is in an IFRAME? Or do I have to make an TEXTAREA to make my WYSIWYG-Editor? I think this is not not possible. Again, please help me.

khalidali63
12-28-2002, 10:34 AM
one more time the code u have written it missing an object for which u want the attribute"value" to return some value.
use this pattern iframe.document.formObjectName.value

Zor
12-28-2002, 10:51 AM
OK here is my code. I don´t know in which way I have to do it...

<html>
<head>
<title>Unbenannt</title>

<script language="JavaScript">
function Init() {
iEdit.document.designMode = 'On';
}

function changeIt() {
document.Formular.data.value = iEdit.document.value;
}
</script>
</head>
<body onLoad="Init()">
<form method="post" action="./testcopyvalue.php" name="Formular">
<iframe name="iEdit" style="width:200px; height:70px"></iframe>
<input type="input" name="data" value="">
<input type="button" onClick="changeIt()">
<input type="submit" value="Senden">
</form>
</body>
</html>

swon
12-28-2002, 11:02 AM
Zor, hope that's what you want:

<html>
<head>
<title>Unbenannt</title>

<script language="JavaScript">
function Init() {
iEdit.document.designMode = 'On';
}

function changeIt() {
dat = iEdit.document.body.innerHTML;
document.Formular.data.value = dat;
}
</script>
</head>
<body onLoad="Init()">
<form method="post" action="./testcopyvalue.php" name="Formular">
<iframe name="iEdit" style="width:200px; height:70px"></iframe>
<input type="text" name="data" value="">
<input type="button" onClick="changeIt()">
<input type="submit" value="Senden">
</form>
</body>
</html>

khalidali63
12-28-2002, 11:10 AM
Ok here it goes

<html>
<head>
<title>Unbenannt</title>

<script language="JavaScript">
function Init() {
iEdit.document.designMode = 'On';
}

function changeIt() {
document.Formular.data.value = iEdit.document.bform.bformText.value;
}
</script>
</head>
<body onLoad="Init()">
<form method="post" action="./testcopyvalue.php" name="Formular">
<iframe name="iEdit" style="width:200px; height:250px" src="bottom.html" frameborder="1"></iframe>
<input type="Text" name="data" value=""><!-- to make it hidden, you have to make type="hidden"-->
<input type="button" onClick="changeIt()" value="Change value">
<input type="submit" value="Senden">
</form>
</body>
</html>

You have to make sure that in iframe there is a page name bottom.html
below is the code for botom.html

both of these pages must be in the same directory

<html>
<head>
<title>Untitled</title>
</head>
<body>
<form name="bform">
<input type="Text" name="bformText" value="Value in iframe object"></input>
</form>
</body>
</html>

Khalid

Zor
12-28-2002, 11:10 AM
Yes thx - that´s it. Where can i get an overview about the elements a document-object carries with itself???

The first one is exactly what I want. And to the second one- ääääärm this is gonna be an editor and no viewingstation of HTML-Documents :D

khalidali63
12-28-2002, 11:15 AM
this is an awsome resource...

http://www.echoecho.com/jsquickref.htm

Khalid