/    Sign up×
Community /Pin to ProfileBookmark

Can’t get parent to access the array in the iframe..

Hi,

Is anyone be able to help me?
Can’t get parent to access the array in the iframe..
I have this code:

(window.open.(boy.image_arrayI[Navegacao.n_pag.value].value));

boy is the name of the iframe.

why isn’t working??

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@KorSep 17.2004 — to access an object which is on a page in iframe try

top.frames['iframe_name'].document.[i]object[/i]
Copy linkTweet thisAlerts:
@Warren86Sep 17.2004 — anselmo69:

Try this:

<HTML>

<Head>

<Script Language=JavaScript>

function getImage(n){

tmp = window.frames['boy'].imgArray[n];
alert(tmp)
}


</Script>

</Head>

<Body>

<Div align=center>

<IFRAME

Name = 'boy'

SRC='1.html'

WIDTH='720'

HEIGHT='250'

Frameborder='yes'

Scrolling='auto'>

</IFRAME>

</Div>

<br>

<input type=button value="Get Image" onClick="getImage(1)">

</Body>

</HTML>

-------------1.html-------

<HTML>

<Head>

<Script Language=JavaScript>

imgArray = new Array()
imgArray[0] = "This is the first image file name"
imgArray[1] = "This is the second image file name"


</Script>

</Head>

<Body>

</BODY>

</HTML>

When you click the button an alert will be displayed with this message:

"This is the second image file name"

In the code, onClick="getImage(1), 1 means the 1 element of the array.
Copy linkTweet thisAlerts:
@anselmo69authorSep 17.2004 — hi,

Tanks for the help.

But i stil have a littel problem...

the array gives me a a new url, that i whant to open in on other iframe...

when i put the window.open in the statment, it doesn't give me any erro, but the new page don't open...

what can i do????
Copy linkTweet thisAlerts:
@Warren86Sep 17.2004 — anselmo:

Use the value from the array to change the "location" of the IFRAME.

window.frames['otherIFrame'].location = arrValue;
Copy linkTweet thisAlerts:
@anselmo69authorSep 17.2004 — hi,

Thanks for the help.

I already resolved the problem.

I did like this:

window.open(window.frames["iframe1"].image_arrayI[n], "MostraNovo");

Sorry my English.
×

Success!

Help @anselmo69 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...