Hi everybody!
Lets see if i can explain what i am trying to achieve.
i have a form to insert some products into a data base... just a normal form. The hardest part is this.
i have a javascript code on a text field that launches a page in a iFrame that is supposed to get the content of the text fild to required data.
Example.
i type "3456" on the text field and when i pass to the next form field it send the link "http://example.php?ex=3456"... the part of loading the page inside the iFrame is done, what I can't seem to achieve is the value to send :-(
is this possible?
thank you and please forgive my english.

Hey Dude,

I did't got this line
what I can't seem to achieve is the value to send


Are u trying to send Big text or somthing?

No... as a matter of fact it will always be a small text string and it will be something like a product code.
What i need it that when the field changes it opens the page inside the iFrame sending the value i typed as query filter... so... if i type this "FC6478" when i continue to the next fom field it opens the page in the iFrame sending the link like "http://justanexample.php?sample=FC6478"

Oh Ok

Here you go

var urll = window.location.search.substring(1);
alert(urll);
qs = urll.split("=");
alert (qs[0]);
drive= qs[0] + ":\\\\" + qs[1] ;

I am sorry... this must be a basic question but i am really a newbie on this.
How can i use your code?
Can you give me an example?
Thank you so much

Say suppose u have two html file
a.html b.html

In a.html u submit the value to B.html

Then in B.html
Use my code ie

<script>
var urll = window.location.search.substring(1);
alert(urll);
qs = urll.split("=");
alert (qs[1]);
</script>

thats it
http://justanexample.php?sample=FC6478
here in qs[1] u ll be having value FC6478

and example b.html is equal to justanexample.php

If u still finding difficult to understand , then U can send me ur code I ll get it done.

You could try this demo:

This will allow you to send text data on the iframe via input field.

— Comes in two separated document(mainpage/iframepage) both file must be uploaded( or saved ) within the same directory.

Here's the code for the mainpage: this is the sender page the one who will send the data to the iframepage.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html id="html40L" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Window-target" content="_top">
<title>Free Live Help!</title>
<script type="text/javascript">
<!--
var my;
var sendPost = function( e ) {
   myForm = (( "getElementById" in document ) ? document.getElementById("form") : document.all[ "form" ] );

   iframe = (( "getElementById" in document ) ? document.getElementById("iframe") : document.all[ "iframe" ] );

   try {
   my = (( "postMessage" in window ) ? parent.iframe : (( "postMessage" in document ) ? parent.iframe.document : "undefined" ));
   } catch( error ) {
   alert("Please upgrade your browser");
   return false;
  }
   
   if ( typeof my !== "undefined" ) {
      form.onsubmit = function() { 
      my.postMessage( form.txt.value, "*" );
      return false;
      }
   }
};
window.onload = sendPost;
// -->
</script>
</head>
<body>
<div id="main">
<form action="#" id="form" name="form"> 
<div><label for="txt">POST TO IFRAME: <input type="text" id="txt" name="txt" value="" size="50"></label><br><br><input type="submit" value="Post Message"></div>
</form>
<div style="margin-top : 2em;">
<iframe style="display : block width : 100%; height : 300px; margin : 0 auto; border : 1px solid #aaa;" src="./iframe.html" id="iframe" name="iframe">Your browser does not support frame pages.</iframe></div>
</div>
</body>
</html>

and here's the code for the iframepage: This file is the receiver of the posted message

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<html id="html40L" lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<meta http-equiv="Window-target" content="_top">
<title>Free Live Help!</title>
<script type="text/javascript">
<!--
var receivePost = function( e ) {
   var div = (( "getElementById" in document ) ? document.getElementById("main") : document.all[ "main" ] );
   div.innerHTML = "";
   div.innerHTML += "<h4>From : </h4>" + e.source.location + "<hr>";
   div.innerHTML += "<h4>Message : </h4>\n<p style=\"color : #190; letter-spacing : 3px\">";
   div.innerHTML += e.data + "</p><hr>";
   };

   if ( "addEventListener" in window ) {
   window.addEventListener( "message", receivePost, false );
   } 
   else if ( "attachEvent" in window ) {
   window.attachEvent( "onmessage", receivePost );
   }
   
   
// -->
</script>
</head>
<body>
<div id="main">

</div>
</body>
</html>

Works in IE7+, FF2+, OP8+, Safari, chrome, etc.

Not recommended in IE6-.

hope it helps...

Use it here in ur second code as shown below
In below code
The value will be stored in qs[1] varable
Thats Y i used alert to debug
U can use qs[1] varable accordingly

<script type="text/javascript">
var urll = window.location.search.substring(1);alert(urll);
qs = urll.split("=");
alert (qs[1]);
var receivePost = function( e ) {
   var div = (( "getElementById" in document ) ? document.getElementById("main") : document.all[ "main" ] );
   div.innerHTML = "";
   div.innerHTML += "<h4>From : </h4>" + e.source.location + "<hr>";
   div.innerHTML += "<h4>Message : </h4>\n<p style=\"color : #190; letter-spacing : 3px\">";
   div.innerHTML += e.data + "</p><hr>";
   };

   if ( "addEventListener" in window ) {
   window.addEventListener( "message", receivePost, false );
   } 
   else if ( "attachEvent" in window ) {
   window.attachEvent( "onmessage", receivePost );
   }
   
   

</script>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.