Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Browsers / Internet Explorer / July 2003



Tip: Looking for answers? Try searching our database.

how to change dynamically frame elements?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GBoul - 26 Jul 2003 14:24 GMT
Hi,
I am new to DHTML and my question might sound simple but I have lost a
couple days on this.

I am putting together a tool which will be used for intranet pursposes.
So, I have a page on which I created 3 frames with the help of FP.
The Left frame contains sections, the right top contains objects
associated with a sections and the right bottom the object details.

What I am trying to do is to set the text of an element of the RightTop
frame to the section name selected on the Left frame. Each frame has its
own page.

So I am trying to do the following:
<script>
function section_ondblclick(){
  window.top.frames["RightTop"].document.all.tdSectionName.innerText =
window.event.srcElement.innertext;
}
</script>

The above script runs on the Left frame. Consider the above as the
logic. I tried different ways of implementing the above.

I have not found if it is possible to change another frame's element, or
not.

Help will be appreciated.
____
GBoul
David Lovell (MSFT) - 27 Jul 2003 21:27 GMT
There are several issues.
1) You are using <elementid>_<eventname> as your function name. I think you
are trying to use vbscript style auto-hookup of event handlers by name. I do
not believe this happens by default in JScript and since you did not specify
a language in the <script> attribute, it is defaulting to JScript.
2) JScript is case sensitive and the second line of your event handler you
call the "innertext" property when really it should be "innerText".

I created a sample that should accomplish what you want:
Here is the code for 3 files, (frameset.htm, left.htm and right.htm)

--- code for frameset.htm ---
<html>
<head>
</head>

<frameset cols="50%,50%">
<frame name="fr_left" src="left.htm">
<frame name="fr_right" src="right.htm">
</frameset>

<noframes>
<body>this page requires frames</body>
</noframes>
</html>

--- code for left.htm ---
<html>
<head>
<script>
function setMonth()
{
  window.top.frames["fr_right"].document.all.chosenMonth.innerText =
 window.event.srcElement.innerText;
}
</script>
</head>
<body>

Left pane
<br />
<br />
Choose Month:<br />
<div onDblClick="setMonth();">
<div>January</div>
<div>February</div>
<div>March</div>
<div>March</div>
</div>
</body>
</html>

--- code for right.htm ---
<html>
<head></head>
<body>
right pane
<br /><br />
Chosen Month will appear here:
<div id="chosenMonth"></div>
</body>
</html>

-------------------
Save those files and open up the frameset.htm. Double-click any of the
months and I think you will have what you need.

Signature

Thanks,
David W. Lovell

This posting is provided "AS IS" with no warranties, and confers no rights.

If a script was included within this post, use of included
script samples are subject to the terms, specified at
http://www.microsoft.com/info/cpyright.htm"

Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.

> Hi,
> I am new to DHTML and my question might sound simple but I have lost a
[quoted text clipped - 26 lines]
> ____
> GBoul
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.