/    Sign up×
Community /Pin to ProfileBookmark

How can I get a id from fram structure?

Hi Friends,
I have a codes of javaScript with below syntax
bg.parent = document.getElementById(“here”);
It works well in simple window.
However, It can not get correct ID under frame structure.
even I changed to
bg.parent = document.getElementById(“document.text.here”);
wha tis wrong for my syntax?
Thanks for any help!!
Fairfax
Note: text as a name of frame.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@jimmyzhuauthorNov 14.2005 — When I changed to

bg.parent = document.getElementById(''top.frames[''text''].here'');

It still does not work.

Friends. Any suggestion?

Thanks

Fairfax
Copy linkTweet thisAlerts:
@JPnycNov 14.2005 — You have to reference the frame 1st.

document.frames[0].

0 for the 1st frame, 1 for the 2nd, etc.
Copy linkTweet thisAlerts:
@jimmyzhuauthorNov 14.2005 — I reference to <td id="here" align="left"></td>

So that I can put some information into that table based on ID from getElementById.

Actually, set ID and get ID in same HTML file. It works well.

When I put into frame. it does not work in correcting way.

Frame structure as

<frameset frameborder="1" framespacing="2" border="1" cols="*" rows="60,*">

<frame marginwidth="0" marginheight="0" src="head.html" name="heading" noresize scrolling="no">

<frameset frameborder="1" framespacing="1" border="0" cols="275,*" >

<frame marginwidth="5" marginheight="5" src="switch.html" name="switch" >

<frame marginwidth="5" marginheight="5" src="text.html" name="text" >

</frameset>
Copy linkTweet thisAlerts:
@jimmyzhuauthorNov 14.2005 — Hi Jpnyc,

Thanks for your help.

I made some changes based on your email.

But I got a error message"document.frames 1 is null or not a object."

my syntax as

bg.parent = document.frames[1].getElementById(''here'');

I got same error after change to 0 or 2.

actually it is a 2 level dynamic frame. switch.html can be other frame structure. However, my code is running in text's frame

Again, Thanks for help.

Fairfax

see frame code:

***********frame source

<frameset frameborder="1" framespacing="2" border="1" cols="*
" rows="60,*">

<frame marginwidth="0" marginheight="0" src="head.html" name="heading" noresize scrolling="no">

<frameset frameborder="1" framespacing="1" border="0" cols="275,*
" >

<frame marginwidth="5" marginheight="5" src="switch.html" name="switch" >

</frameset>

<frame marginwidth="5" marginheight="5" src="text.html" name="text" >

</frameset>
×

Success!

Help @jimmyzhu 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 5.18,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...