Connecting Tech Pros Worldwide Forums | Help | Site Map

placing controls on Iframe.

sandyuhd
Guest
 
Posts: n/a
#1: Jul 23 '05

HI,
i'm creating acomposite web control.
for this i'm using iframe as dropdown.
Through javascript i'm creating iframe onthe page.
and ihave to display labels and textboxesin the iframe which will have
the data .
my question is how to create labels and textboxes on an iframe.
can somebody help me out

thanx
sandyuhd


Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#2: Jul 23 '05

re: placing controls on Iframe.


sandyuhd wrote:
[color=blue]
> i'm creating acomposite web control.
> for this i'm using iframe as dropdown.[/color]

Of all the block elements that could be (ab)used for a dropdown control
(without Clean Degradation, though), the `iframe' element appears to me
the least suited. Use a `div' element if you have to, use a `select'
element for Clean Degradation.
[color=blue]
> Through javascript i'm creating iframe onthe page.[/color]

Which does not mean that you have to use it for the dropdown control.
[color=blue]
> and ihave to display labels and textboxesin the iframe which will have
> the data .
> my question is how to create labels and textboxes on an iframe.[/color]

Provided that the target iframe document is located on the same
second-level domain than the source document:

/**
* @author
* (C) 2003, 2004 Thomas Lahn <types.js@PointedEars.de>
* @optional Object o
* Object to be determined an method, i.e. a
* <code>Function</code> object assigned as property of
* another object. May also be a string to be evaluated
* and so is applicable to unknown properties.
* @return type boolean
* <code>true</code> if <code>o</code> is a method,
* <code>false</code> otherwise.
* @see #isMethodType()
*/
function isMethod(m)
{
var t;
(m = eval(m)) && (t = typeof m);
return (t == "function" || t == "object");
}

// Only if sub-level domains differ, see Same Origin Policy
document.domain = "my-second-level-do.main";

var
f,
d = (f = frames['myIFrame']) && f.document,
b,
textbox;

if (d
&& (b = d.body)
&& isMethodType("b.appendChild")
&& isMethodType("d.createElement")
&& ((textbox = d.createElement('input')))
{
d.body.appendChild(textbox);
}
[color=blue]
> can somebody help me out[/color]

Yes.


PointedEars
Closed Thread