Is it possible to have "sourceless" multiple iframes on one page?

D

Don Li

Hi,

What I mean is, when you have a database query you want each data set
to be populated by each iframe on a page. So, in this case, how do we
work around the Attribute of SRC="whateverFile.Ext" issue, how can we
use something more like
// pseuduo coding

var i = db.dataset[index];
// loop through them ...
var frm = new Object();
frm.src = db.dataset;

then;
<iframe id="unikID" src=[frm.src]></iframe>

How does this work? Care to shed some light?

Thank you.
 
S

SAM

Don Li a écrit :
Hi,

What I mean is, when you have a database query you want each data set
to be populated by each iframe on a page.

If it is a database query I understand that all is made server-side and
the final html page with results (why in iframes ?) is send to the browser.
So, in this case, how do we
work around the Attribute of SRC="whateverFile.Ext" issue, how can we
use something more like
// pseuduo coding

Or do you use an Ajax method for your query ?
var i = db.dataset[index];

Anyway the database query runs server side and results have to be sent
back to the browser, this time using 'responseText' linked to function
XHTMLRequest
// loop through them ...
var frm = new Object();

the responseText could be a JS array or even a kind of cvs
eventually displayed in an hidden span, div or object, JS then analyzes
these new datas to send (display) them where you want on the page.
frm.src = db.dataset;


example of returned datas
(in the responseText HTML-innered in a hidden span):

page_1.htm;image_2.jpg;form_3.php

var D = document.getElementById('hiddenSpan').textContent.split(';');
for(var i=0; i<D.length; i++)
if(parent.frames) parent.frames.location = D;
<iframe id="unikID" src=[frm.src]></iframe>

var ifrm = document.createElement('iframe');
ifrm.src = 'page_1.htm';
document.body.appendChild(ifrm);
How does this work? Care to shed some light?

google : XHTMLRequest responseText ajax json query XHR

Good luck.
 
T

Thomas 'PointedEars' Lahn

Don said:
What I mean is, when you have a database query you want each data set
to be populated by each iframe on a page. So, in this case, how do we
work around the Attribute of SRC="whateverFile.Ext" issue, how can we
use something more like
// pseuduo coding

var i = db.dataset[index];
// loop through them ...
var frm = new Object();
frm.src = db.dataset;

then;
<iframe id="unikID" src=[frm.src]></iframe>

How does this work? Care to shed some light?


You could assign a string using the `javascript:' or `data:' URI scheme to
the `src' property. The only problem is IE's URI length restriction to 1083
characters and its not supporting the `data' URI scheme up to version 7.

http://en.wikipedia.org/wiki/Data:_URI_scheme


PointedEars
 
D

Don Li

Thank you. It's good to know all the specs. The 1083 characters
limitation for URI really sucks.
My specific column length is 3500, which means now I would have
eliminate this option. Please elaborate on the javascript option (I'm
heavy into js but am willing to dig...).

Don said:
What I mean is, when you have a database query you want each data set
to be populated by each iframe on a page.  So, in this case, how do we
work around the Attribute of SRC="whateverFile.Ext" issue, how can we
use something more like
// pseuduo coding
var i =  db.dataset[index];
// loop through them ...
var frm = new Object();
frm.src = db.dataset;

then;
<iframe id="unikID" src=[frm.src]></iframe>
How does this work?  Care to shed some light?

You could assign a string using the `javascript:' or `data:' URI scheme to
the `src' property.  The only problem is IE's URI length restriction to 1083
characters and its not supporting the `data' URI scheme up to version 7.

http://en.wikipedia.org/wiki/Data:_URI_scheme

PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
)  // Plone, register_function.js:1- Hide quoted text -

- Show quoted text -
 
D

Don Li

op omitted ...
the responseText could be a JS array or even a kind of cvs
eventually displayed in an hidden span, div or object, JS then analyzes
these new datas to send (display) them where you want on the page.
frm.src = db.dataset;


example of returned datas
(in the responseText HTML-innered in a hidden span):

page_1.htm;image_2.jpg;form_3.php

var D = document.getElementById('hiddenSpan').textContent.split(';');
for(var i=0; i<D.length; i++)
if(parent.frames) parent.frames.location = D;
<iframe id="unikID" src=[frm.src]></iframe>

var ifrm = document.createElement('iframe');
ifrm.src = 'page_1.htm';
document.body.appendChild(ifrm);
How does this work?  Care to shed some light?

google : XHTMLRequest responseText ajax json query XHR

Good luck.


Hi, Thank you. Here's the thing. The feature (Inline Editing) is
actually working. A bit more detail, diplay two columns for each row
from a db table, upon click of {column a}, make {column b} editable;
then upon editing/save, refresh {column b} in display mode (hence user
see change immediately). It seems working fine. The only thing I
strongly dislike is that I'm using a third party tool, WYSIWYG editor,
called FckEditor (I'm sure the developer is very smart), however, it's
bloated for my need, and not customizable with Adobe's ColdFusion, my
users would only need the core editing features like Bold, Italic,
List(both types), Text Color and Add Link. Why would I want the 376
files spanning 51 folders package for that? Way overkill, it
seriously slows loading etc. Hence, I started to 'home grow' a simple
WYSIWG editor myself, it's more than half way there, the editor is
working, dynamic data editing/save (without reload the page) is
working, what is the target data refresh, I've just looked up iframe
refresh and tried it without desired result. I could update the {src
file} dynamically but have not tried, even if successful, I'm
concerned about file I/O cost...

FYI, YSLOW indicates page loading takes 4+ seconds with FckEditor
while -2 seconds without it, very substantial difference.

Would your technique achieve the goal here? Many thanks.
 
T

Thomas 'PointedEars' Lahn

Don said:
Thank you. It's good to know all the specs. The 1083 characters
limitation for URI really sucks.
My specific column length is 3500, which means now I would have
eliminate this option. Please elaborate on the javascript option (I'm
heavy into js but am willing to dig...).

Enter this into your address bar:

javascript:'foo'

If it displays `foo', you can probably use it to create a temporary document
in the tested user agent.

Using a `javascript:' URI would make not much difference regarding IE's
length restriction, though. However, after thinking about this, you could
probably define a document template with the `javascript:' or `data:' URI
and then use DOM features to build the rest of its content. Using a
`javascript:' URI, that works in IE 7, but not in Fx 2. It does not seem to
work with a `data:' URI in Fx 2 either, but that UA also has no URI length
restriction that I am aware of.

While it is certainly possible to use

var s = '...<html>...<\/html>';
if (dataURIsupported)
{
o.src = "data:text/html;charset=ISO-8859-1," + encodeURIComponent(s);
}
else if (javascriptURIsupported)
{
o.src = "javascript:'" + s.replace(/'/g, "\\$&") + "'";
}

you would need to determine the support for either feature somehow, and
neither property value checking nor exception handling appear to work in IE
7. That might force you to try telling user agents apart which is almost
always a bad idea.

However, regarding database queries I don't see why you could not refer to a
server-side generated document resource using an `http:' or `https:' URI.

Please don't top-post. http://www.jibbering.com/faq/faq_notes/clj_posts.html


PointedEars
 
D

Don Li

Enter this into your address bar:

  javascript:'foo'

If it displays `foo', you can probably use it to create a temporary document
in the tested user agent.

Using a `javascript:' URI would make not much difference regarding IE's
length restriction, though.  However, after thinking about this, you could
probably define a document template with the `javascript:' or `data:' URI
and then use DOM features to build the rest of its content.  Using a
`javascript:' URI, that works in IE 7, but not in Fx 2.  It does not seem to
work with a `data:' URI in Fx 2 either, but that UA also has no URI length
restriction that I am aware of.

While it is certainly possible to use

  var s = '...<html>...<\/html>';
  if (dataURIsupported)
  {
    o.src = "data:text/html;charset=ISO-8859-1," + encodeURIComponent(s);
  }
  else if (javascriptURIsupported)
  {
    o.src = "javascript:'" + s.replace(/'/g, "\\$&") + "'";
  }

you would need to determine the support for either feature somehow, and
neither property value checking nor exception handling appear to work in IE
7.  That might force you to try telling user agents apart which is almost
always a bad idea.

However, regarding database queries I don't see why you could not refer toa
server-side generated document resource using an `http:' or `https:' URI.

Please don't top-post.  http://www.jibbering.com/faq/faq_notes/clj_posts..html

PointedEars
--
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Ok, the following is what I got,

// pseudo code the query out part
query out

// use javascript to set each frame.src value with each data set
<script type="text/javascript">
<!--
function bindData#currentrow#() {
// define and assign frame object
var fobj#currentrow#;
fobj#currentrow# = document.frames['text#currentrow#'];

// get each data set
var s#currentrow# = '<html>#detailedData#<\/html>';

// instantiate object and populate it with data
fobj#currentrow# = new Object();
fobj#currentrow#.src = "javascript:'" + s.replace(/'/g, "\\$&") +
"'";
}

// call the function
bindData#currentrow#();
//-->
</script>

// now display iframe etc.
<iframe id="unikID"></iframe>
...

But I got none-descriptive javascript error. Oh, yes, the test of
javascript:foo passed with IE7.
What was I doing wrong?

Many thanks.

P.S. Sorry about the previous top-posting.
 
T

Thomas 'PointedEars' Lahn

Don said:
[...]
While it is certainly possible to use

var s = '...<html>...<\/html>';
if (dataURIsupported)
{
o.src = "data:text/html;charset=ISO-8859-1," + encodeURIComponent(s);
}
else if (javascriptURIsupported)
{
o.src = "javascript:'" + s.replace(/'/g, "\\$&") + "'";
}

you would need to determine the support for either feature somehow, and
neither property value checking nor exception handling appear to work in IE
7. That might force you to try telling user agents apart which is almost
always a bad idea.

However, regarding database queries I don't see why you could not refer to a
server-side generated document resource using an `http:' or `https:' URI.
[...]

Ok, the following is what I got,

// pseudo code the query out part
query out

// use javascript to set each frame.src value with each data set
<script type="text/javascript">
<!--

Remove this pseudo-comment; it is an unnecessary, error-prone practice.
[...]
But I got none-descriptive javascript error. Oh, yes, the test of
javascript:foo passed with IE7.
What was I doing wrong?

You have posted too little real code to analyze.
P.S. Sorry about the previous top-posting.

Now you only have to learn from the FAQ Notes how to stop full-quoting in
favor of interleaved quoting, and how to ascertain and to post useful error
descriptions.


PointedEars
 
D

Don Li

Don said:
[...]
While it is certainly possible to use
  var s = '...<html>...<\/html>';
  if (dataURIsupported)
  {
    o.src = "data:text/html;charset=ISO-8859-1," + encodeURIComponent(s);
  }
  else if (javascriptURIsupported)
  {
    o.src = "javascript:'" + s.replace(/'/g, "\\$&") + "'";
  }
you would need to determine the support for either feature somehow, and
neither property value checking nor exception handling appear to work in IE
7.  That might force you to try telling user agents apart which is almost
always a bad idea.
However, regarding database queries I don't see why you could not referto a
server-side generated document resource using an `http:' or `https:' URI.
[...]
Ok, the following is what I got,
// pseudo code the query out part
query out
// use javascript to set each frame.src value with each data set
<script type="text/javascript">
  <!--

Remove this pseudo-comment; it is an unnecessary, error-prone practice.
[...]
But I got none-descriptive javascript error.  Oh, yes, the test of
javascript:foo passed with IE7.
What was I doing wrong?

You have posted too little real code to analyze.
P.S. Sorry about the previous top-posting.

Now you only have to learn from the FAQ Notes how to stop full-quoting in
favor of interleaved quoting, and how to ascertain and to post useful error
descriptions.

PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
  -- Richard Cornford, cljs, <[email protected]>- Hide quoted text -

- Show quoted text -

Ok. More background info. The app uses Adobe's Cold Fusion 8 as web
programming language.
This feature that I'd like to optimize is inside a javascript-launched
window by this Adobe's product, and html-wise, it uses DIV to wrap the
window.

To get basic things working with my new approach, I'm now doing the
following:
1. run a data query
2. output only the first two rows (detailed process below)

a) javascript to bind data set to each iframe src
<div id="bd#currentrow#">
above posted javascript goes here...
</div>

<form id="frm#currentrow#">
b) use the product specific feature to bind a hidden field's data
that an iframe entails
<cfdiv id="displayRow#currentrow#"
bind="{DataHiddenField#currentrow#}"></cfdiv>
c) iframe data editing (user interaction) area including WYSIWYG
javascript event triggers
<div id="fm#currentrow#" style="display: inline;">
<input type="button" onclick="makeBold(#currentrow#)" value="B"/>
...
<iframe name="text#currentrow#" id="text#currentrow#"></iframe>
<input type="hidden" id="DataHiddenField#currentrow#"
value="#detailData#"/>
</div>
d) now provide function buttons
<div id="f#currentrow#" align="right">
<input type="button" value="test js"
onclick="javascript:alert(document.frames['text#currentrow#'].src);">
</div>
</form>

Page load indicate javascript error for two instances. The js test
generated err msg of "undefined". My own suspicion is either my
javascript is faulty or Cold Fusion failed to run the above javascript
or...

Thanks you very much and please bear with me on the ettique stuff...
 
L

Lasse Reichstein Nielsen

Don Li said:
Ok. More background info. The app uses Adobe's Cold Fusion 8 as web
programming language.

Ok, I can't help you with that. Any help will be non-Cold Fusion
specific. For help with Cold Fusion itself, you should locate a dedicate
Cold Fusion newsgroup.

Do remember that the people watching your page are not using Cold
Fusion, but plaing browsers. That is where the page must work, no
matter what authoring aids you use. That also means that it is the
page that is sent to the browser that you should debug, not the
Cold Fusion code.
This feature that I'd like to optimize is inside a javascript-launched
window by this Adobe's product, and html-wise, it uses DIV to wrap the
window.

That makes no sense. Windows are top-level browser controlled
viewports. They can't be wrapped by a div, which is a page level
element.

Is it the content of the window that is wrapped in a div?
To get basic things working with my new approach, I'm now doing the
following:
1. run a data query
2. output only the first two rows (detailed process below)

a) javascript to bind data set to each iframe src
<div id="bd#currentrow#">
above posted javascript goes here...
</div>

"#" is not a valid character in an id tag. Is this Cold Fusion code?
We need to see the code that is actually sent to the browser.
<form id="frm#currentrow#">
b) use the product specific feature to bind a hidden field's data
that an iframe entails
<cfdiv id="displayRow#currentrow#"
bind="{DataHiddenField#currentrow#}"></cfdiv>

Again, we have no way of knowing what that means unless we see
the page that is actually sent to the browser.

....
Page load indicate javascript error for two instances.

Try it in Firefox or Opera or something else that gives actually
usefull error messages, and then see if it a) still fails and
b) with what error message.
The js test generated err msg of "undefined". My own suspicion is
either my javascript is faulty or Cold Fusion failed to run the
above javascript or...

Your guess is a good as mine, or better.
Give a link to the page itself, that will make debugging much easier
(read: possible).

/L
 
D

Don Li

Ok, I can't help you with that. Any help will be non-Cold Fusion
specific. For help with Cold Fusion itself, you should locate a dedicate
Cold Fusion newsgroup.

Do remember that the people watching your page are not using Cold
Fusion, but plaing browsers. That is where the page must work, no
matter what authoring aids you use. That also means that it is the
page that is sent to the browser that you should debug, not the
Cold Fusion code.


That makes no sense. Windows are top-level browser controlled
viewports. They can't be wrapped by a div, which is a page level
element.

Is it the content of the window that is wrapped in a div?



"#" is not a valid character in an id tag. Is this Cold Fusion code?
We need to see the code that is actually sent to the browser.


Again, we have no way of knowing what that means unless we see
the page that is actually sent to the browser.

...


Try it in Firefox or Opera or something else that gives actually
usefull error messages, and then see if it a) still fails and
b) with what error message.


Your guess is a good as mine, or better.
Give a link to the page itself, that will make debugging much easier
(read: possible).

/L

Thank you. I wasn't thinking when posting the code with Cold Fusion
stuff. I just step out of the app and tested the raw html code with
iframe and the javascript technique offered by Thomas 'PointedEars'
Lahn. Here's the code, the alert event trigger indicated that the
frame.src value has been set correctly, however, the test data did not
show up within the frame upon loading, what's wrong?

Many thanks.

<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
function bindData() {
// define and assign frame object and test var
var fobj, notes
fobj = document.frames['textbox'];

notes = "A set of test data";

// set to edit mode
frames['textbox'].document.designMode = "On";

// get each data set
var s = '<html>' + notes + '<\/html>';

fobj.src = s;

alert(fobj.src);

/* instantiate object
fobj = new Object();
fobj.src = "javascript:'" + s.replace(/'/g, "\\$&") + "'";
fobj.src = s;
*/
}

//-->
</script>
</head>

<body onload="bindData();">

<form method="post">
<iframe name="textbox" id="textbox" style="width:300px; height:
150px"></iframe><br/>
<input type="hidden" id="text" name="text"/>
</form>

</body>
</html>
 
L

Lasse Reichstein Nielsen

Don Li said:
On Mar 17, 7:48 am, Lasse Reichstein Nielsen <[email protected]> wrote:

Please trim your quotes to what is necessary to give context to your answer.

I just step out of the app and tested the raw html code with
iframe and the javascript technique offered by Thomas 'PointedEars'
Lahn. Here's the code, the alert event trigger indicated that the
frame.src value has been set correctly, however, the test data did not
show up within the frame upon loading, what's wrong?

Many thanks.

<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--

(omit the "<!--", it does no good, and can in some cases do harm)
function bindData() {
// define and assign frame object and test var
var fobj, notes
fobj = document.frames['textbox'];

So fobj refers to a frame. That will be the global object of another
document, if a document has been loaded into the frame.
It is not the iframe element in the current document!
notes = "A set of test data";

// set to edit mode
frames['textbox'].document.designMode = "On";

Non-standard feature, probably won't work in all browsers.
// get each data set
var s = '<html>' + notes + '<\/html>';

fobj.src = s;

The global object has no "src" attribute with any specific meaning.
You are just creating a property on the fobj object called "src",
but it doesn't mean anything.

If it did, it should probably be a URL, not the HTML source of a
document.
alert(fobj.src);

This reports that a meaningless attribute has been successfully set.

What you appear to want is to change the content of the iframe:
<iframe name="textbox" id="textbox" style="width:300px; height:
150px"></iframe>

To do that you should assign to the src attribute of the iframe
element, giving it a new URL:

document.getElementById("textbox").src = newURL;

or change the content of the iframe's document:

var doc = window.frames["textbox"].document;
doc.open();
doc.write("<html>...new page content ...</html>");
doc.close();

/L
 
H

Henry

On Mar 17, 4:07 pm, Lasse Reichstein Nielsen wrote:
What you appear to want is to change the content of the
iframe:


To do that you should assign to the src attribute of the
iframe element, giving it a new URL:

document.getElementById("textbox").src = newURL;

Not necessarily because the specification for the - src - property of
the HTMLIFrameElement interface says that it is "A URI designating the
initial frame contents" and it is difficult to assert that changing
the value of "the initial frame contents" should be expected to have
useful consequences (particularly navigating to a URI which will then
not be the initial frame contents).
or change the content of the iframe's document:

var doc = window.frames["textbox"].document;
doc.open();
doc.write("<html>...new page content ...</html>");
doc.close();

Or navigating the frame to the URL by assigning the URL to the
location property of the frame.

frames['textbox'].location = newURL;
 
D

Don Li

To do that you should assign to the src attribute of the iframe
element, giving it a new URL:

 document.getElementById("textbox").src = newURL;

or change the content of the iframe's document:

 var doc = window.frames["textbox"].document;
 doc.open();
 doc.write("<html>...new page content ...</html>");
 doc.close();

/L

I'm a bit confused by this newURL thing. I don't want newURL.
What I want is more like

var s;
s = "a test string";

var doc = window.frames["textbox"].document;
then, question a:
how to map the var s's value to the iframe named "textbox" 's src
property.

then question b:
when the src value changes, how to bind this new value to a hidden
form field, say, {dataField}?

Thanks.
 
D

Don Li

To do that you should assign to the src attribute of the iframe
element, giving it a new URL:
 document.getElementById("textbox").src = newURL;
or change the content of the iframe's document:
 var doc = window.frames["textbox"].document;
 doc.open();
 doc.write("<html>...new page content ...</html>");
 doc.close();

I'm a bit confused by this newURL thing.  I don't want newURL.
What I want is more like

var s;
s = "a test string";

var doc = window.frames["textbox"].document;
then, question a:
how to map the var s's value to the iframe named "textbox" 's src
property.

then question b:
when the src value changes, how to bind this new value to a hidden
form field, say, {dataField}?

Thanks.- Hide quoted text -

- Show quoted text -

It's disappointing that the question halfly answered like a meal is
half-cooked when it needs to be cooked.
 
S

SAM

Don Li a écrit :
I'm a bit confused by this newURL thing. I don't want newURL.
What I want is more like

var s;
s = "a test string";

var doc = window.frames["textbox"].document;
then, question a:
how to map the var s's value to the iframe named "textbox" 's src
property.

.... on va pas y arriver ...

1- You cant do nothing with the src of an iframe
was tolted to you.

2- An 'iframe' is a 'window' and have to be considered as is.
You must change its content loading in it a file (html file) :

parent.frames['txtbox'].location = url;

('txtbox' is the *NAME* of the iframe)


3- The other way is to write directly in the document displayed
in the iframe, as said besides.


4- Probably you can use DOM :

var targ = document.getElementById('myIframe');
var I = targ.cloneNode(true);
I.src = s; // or : I.src = url;
targ.parentNode.replaceChild(I, targ);

(not tested) ('myIframe' is the *ID* of the iframe)


5- Wouldn't be possible to display the value directly in a div or span ?

then question b:
when the src value changes, how to bind this new value to a hidden
form field, say, {dataField}?

why to ask that ?
couldn't be the hidden input that receives the value, then the iframe ?

var s = 'a test string'
document.formReport.hideReport.value = s;
var D = parent.txtbox.document;
D.open();
D.write(s);
D.close();


Now,
aren't you triyng to use a kind of text-editor to fix your entries ?
google : text-editor javascript dom
 
D

Don Li

Don Li a écrit :


I'm a bit confused by this newURL thing.  I don't want newURL.
What I want is more like
var s;
s = "a test string";
var doc = window.frames["textbox"].document;
then, question a:
how to map the var s's value to the iframe named "textbox" 's src
property.

... on va pas y arriver ...

1- You cant do nothing with the src of an iframe
    was tolted to you.

2- An 'iframe' is a 'window' and have to be considered as is.
    You must change its content loading in it a file (html file) :

     parent.frames['txtbox'].location = url;

     ('txtbox' is the *NAME* of the iframe)

3- The other way is to write directly in the document displayed
    in the iframe, as said besides.

4- Probably you can use DOM :

var targ = document.getElementById('myIframe');
var I = targ.cloneNode(true);
I.src = s;   //  or :  I.src = url;
targ.parentNode.replaceChild(I, targ);

   (not tested) ('myIframe' is the *ID* of the iframe)

5- Wouldn't be possible to display the value directly in a div or span ?
then question b:
when the src value changes, how to bind this new value to a hidden
form field, say, {dataField}?

why to ask that ?
couldn't be the hidden input that receives the value, then the iframe ?

var s = 'a test string'
document.formReport.hideReport.value = s;
var D = parent.txtbox.document;
D.open();
D.write(s);
D.close();

Now,
aren't you triyng to use a kind of text-editor to fix your entries ?
google : text-editor javascript dom

Great. Tired, will try it tomorrow. btw, everything is on a one
page, do we still need {parent}?
Does the {parent.txtbox.document} as in {var D =
parent.txtbox.document} refers the an iframe's content, so, if I have
the first iframe with id of "myFrame1", would I express it as
parent.frames['myFrame1'].document or just
frames['myFrame1'].document, make it {var D =
frames['myFrame1'].document} ?

Many thanks.
 
D

Don Li

Don Li a écrit :
I'm a bit confused by this newURL thing.  I don't want newURL.
What I want is more like
var s;
s = "a test string";
var doc = window.frames["textbox"].document;
then, question a:
how to map the var s's value to the iframe named "textbox" 's src
property.
... on va pas y arriver ...
1- You cant do nothing with the src of an iframe
    was tolted to you.
2- An 'iframe' is a 'window' and have to be considered as is.
    You must change its content loading in it a file (html file) :
     parent.frames['txtbox'].location = url;
     ('txtbox' is the *NAME* of the iframe)
3- The other way is to write directly in the document displayed
    in the iframe, as said besides.
4- Probably you can use DOM :
var targ = document.getElementById('myIframe');
var I = targ.cloneNode(true);
I.src = s;   //  or :  I.src = url;
targ.parentNode.replaceChild(I, targ);
   (not tested) ('myIframe' is the *ID* of the iframe)
5- Wouldn't be possible to display the value directly in a div or span ?
why to ask that ?
couldn't be the hidden input that receives the value, then the iframe ?
var s = 'a test string'
document.formReport.hideReport.value = s;
var D = parent.txtbox.document;
D.open();
D.write(s);
D.close();
Now,
aren't you triyng to use a kind of text-editor to fix your entries ?
google : text-editor javascript dom

Great.  Tired, will try it tomorrow.  btw, everything is on a one
page, do we still need {parent}?
Does the {parent.txtbox.document} as in {var D =
parent.txtbox.document} refers the an iframe's content, so, if I have
the first iframe with id of "myFrame1", would I express it as
parent.frames['myFrame1'].document or just
frames['myFrame1'].document, make it  {var D =
frames['myFrame1'].document} ?

Many thanks.- Hide quoted text -

- Show quoted text -

Hi all,

Just an update. The good news is, I can now populate and reference an
iframe.src dynamically and performs business function as desired, it
seems to work as expected without any error. But the bad news is, in
a minute or two, it can go bananas... it would complain about "Object
expected" and simply won't do anything. Does that suggest that my box
may have been compromised? For instance, some nasty javascript kitty
running in the shadow or the like?

Many thanks.
 

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
474,436
Messages
2,571,696
Members
48,796
Latest member
Greg L.
Top