Connecting Tech Pros Worldwide Forums | Help | Site Map

Frame/form question

Dfenestr8
Guest
 
Posts: n/a
#1: Jul 20 '05
Hi.

I'm trying to build a page that has two frames, both of which are
generated by a different cgi script.

The lower frame is generated by a script called "control.py".

The upper frame is generated by a script called "getchat.py".

On the lower frame, there is a button called "REFRESH". When clicked, I
want it to be able to read information in a hidden input on a form in the
upper frame, that being .....

<input type=hidden NAME="last_seen" value = "' + str(lastByteLoc) + '">

.... and submit that information to getchat.py.

I have a javascript routine worked out which *usually* does that when I
view the page with konqueror. Unfortunately it never seems to work with
mozilla. Can anybody tell me why? And better still, how I can fix it?

Here's the code generated by control.py ......

In the <head> i have ....

<script language = "javascript">
<!-- hide from older browsers

function refreshPosts()
{
plast = parent.chatframe.form1.last_seen.value;
parent.chatframe.location = 'getchat.py?last_seen=' + plast
}

//-->
</script>

And on the form in the lower frame, I have this input ......

<input type = "button" value = "REFRESH" onClick = "refreshPosts()">

Thanx in advance.


kaeli
Guest
 
Posts: n/a
#2: Jul 20 '05

re: Frame/form question


In article <pan.2003.11.22.16.27.34.574791@yahoo.com.au>,
chrisdewinN0SPAM@yahoo.com.au enlightened us with...[color=blue]
>
> function refreshPosts()
> {
> plast = parent.chatframe.form1.last_seen.value;[/color]

parent.chatframe is a window object. Form belongs to document.

plast = parent.chatframe.document.form1.last_seen.value;

--
--
~kaeli~
Do not taunt Happy Fun Ball!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Lasse Reichstein Nielsen
Guest
 
Posts: n/a
#3: Jul 20 '05

re: Frame/form question


kaeli <tiny_one@NOSPAM.comcast.net> writes:
[color=blue]
> parent.chatframe is a window object. Form belongs to document.
>
> plast = parent.chatframe.document.form1.last_seen.value;[/color]

or better yet (since I prefer to use the appropriate collections :)

plast = parent.frames['chatframe'].document.forms['form1'].
elements['last_seen'].value;

There is no official standard for Javascript access to frames,
so I can't say that using the frames collection is more official than
just assuming the frames are direct properties of their parent.

However, the W3C DOM specification requires the forms collection, and
there is no requirement that forms are available as properties of the
document element. That means that a (hypothetical) strictly standards
adhering browser (implementing nothing unofficial) will only work
using the forms collection.

Ditto for the elements collection.

/L
--
Lasse Reichstein Nielsen - lrn@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Dfenestr8
Guest
 
Posts: n/a
#4: Jul 20 '05

re: Frame/form question


On Sat, 22 Nov 2003 15:25:31 +0000, kaeli wrote:
[color=blue]
> In article <pan.2003.11.22.16.27.34.574791@yahoo.com.au>,
> chrisdewinN0SPAM@yahoo.com.au enlightened us with...[color=green]
>>
>> function refreshPosts()
>> {
>> plast = parent.chatframe.form1.last_seen.value;[/color]
>
> parent.chatframe is a window object. Form belongs to document.
>
> plast = parent.chatframe.document.form1.last_seen.value;[/color]

Thanx. That does the job.

Now it works perfectly with mozilla but sometimes breaks when using
Konqueror. Specifically, when I press REFRESH, but there's nothing new to
update the chatframe with. After that, REFRESH won't work again until I
reload the whole page.
kaeli
Guest
 
Posts: n/a
#5: Jul 20 '05

re: Frame/form question


In article <pan.2003.11.23.06.33.09.111180@yahoo.com.au>,
chrisdewinN0SPAM@yahoo.com.au enlightened us with...[color=blue]
>
> Thanx. That does the job.
>
> Now it works perfectly with mozilla but sometimes breaks when using
> Konqueror. Specifically, when I press REFRESH, but there's nothing new to
> update the chatframe with. After that, REFRESH won't work again until I
> reload the whole page.
>[/color]

See Lasse's response - Konqueror may need the full reference instead of
the shortcut I'm used to (I do mostly intranet apps and only have to
deal with NN/IE).

--
--
~kaeli~
Press any key to continue or any other key to quit
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Closed Thread