[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help



>I'm looking for a JavaScript help. I want to do several things:
>
>a) I'm developing a site which utilizes four frames.  From the NAVBAR
>frame, I want to click an icon, which then updates TWO of the other frames.
>How do I do it?
>

Try the following:

<html>
<head>
<title>Control Frame</title>
<BASE HREF="file:///f|/java/control.html">
<script name="javascript">
function doButton()
    {
    parent.frames['DATA1'].location.href="file1.html";
    parent.frames['DATA2'].location.href="file2.html";
    }

</script>
</head>
<body>
<p>
<center>
<h4>Nav Bar</h4>
<a href="javascript:doButton()"><img src="graphics/button.gif"
alt="[BUTTON]" width=80 height=50 border=0></img></a><br>
</center>
</body>
</html>

Note:

1. You need the BASE HREF tag as Netscape will otherwise try to load file1 and
   file2 using the followong href "javascript://file1.html" while will be
   rubbish and generate an error.

2. Make sure you have given target names "DATA1" and "DATA2" to the frames
   in question in your frame holder script. Do something  like

    <FRAME NAME="DATA1" SRC="about:blank">
    <FRAME NAME="DATA2" SRC="about:blank">

    the URL about:blank will just create a blank frame with nothing in it.



>b) One of these updated frames should then run a JavaScript, which randomly
>generates a number between 1 and 20, and appends it to a file name (ie,
>graphic.7.gif), which is then loaded. A timer then begins, and counts 30
>seconds and then adds 1 to the file name (ie, graphic.8.gif) which is then
>loaded. and so on. Once it reaches graphic.20.gif, the cycle should restart
>at graphic.1.gif.
>
>Anyone? If you can help even with the A) question, it would be a lifesaver.
>

The random() function does not work as yet with 2.0. You could use something 
like the date and time to generate a random number. You then need to use
setTimeout() function to do the rest - see docs on Javascript for a good
example.

Alternatively if as I suspect you want to do some sort of animation using gifs
then you can use a little known feature of Netscape 2.0 and GIF89A to to same.
See http://members.aol.com/royalef/gifanim.htm for info, examples and tools.
[Daniel Grealy daniel@dircon.co.uk]

--------------------------------------------------------------------
This message came from the mailing list javascript. For help using the
mailing list software, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.