andes
10-16-2007, 02:20 PM
Hi.
A long story short:
I'm using a CSS dropdown menu I found here
http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm
... This is a .js which loads just fine, and works properly.
I'm also using a second .js which ain't working that well. The .js contains the following code:
function openOtherLinks(id1, id2) {
var link1 = document.getElementById(id1);
var link2 = document.getElementById(id2);
if(!link1.href || !link2.href)
return;
self.frames['left'].location.href = link2.href;
self.frames['main'].location.href = link1.href;
}
And the html heading contains among other things these lines:
<script type="text/javascript" src="java/meny.js"</script>
<script type="text/javascript" src="java/links.js"</script>
Where links.js contains the code i wrote above.
The links-script makes me able to make a "<a href" opening two targets at once, with each their targets (which in this case would be iframes).
Making parts of my html like this:
<a href="javascript: openOtherLinks('rotel1', 'rotel2')">Rotel</a>
<a href="javascript: openOtherLinks('tannoy1', 'tannoy2')">Tannoy</a>
... And the following anywhere outside the body:
<a id="tannoy1" href="tannoy_overview.html"></a>
<a id="tannoy2" href="tannoy_left.html"></a>
<a id="rotel1" href="rotel_overview.html"></a>
<a id="rotel2" href="rotel_left.html"></a>
Two examples of combinations I've trid:
http://www.risington.no/dynamikk/
- This one contains the links-script in the heading, and loads the dropmenu from the .js, which works out just fine in mozilla firefox and safari but NOT explorer. Tried out both 6.xx and 7.
http://www.risington.no/dynamikk/index2.html
- This one loads both the scripts external. But here the a href-part suddenly seems to be getting a slight problem. I'd believe it would be because of that the a hrefs is directed straight to a couple of tags in the script itself. But I'm far from no brain surgent when it comes to these kind of things.
1. Should the .js look different ? Or is this correct ?
2. Whenever I put the code in links.js directly in the heading of the html, it works but then it screws up the menu-script when the page is viewed in Explorer. (which was my problem at first).
3. Any ideas of how I could combine these scripts? Does it matter if I'm using them seperatly as .js-files or if I'm just putting it all directly into the heading? Is it ok to load one as an external js, as I put the other one in the heading?
Any help here would be awesome :=)
A long story short:
I'm using a CSS dropdown menu I found here
http://www.dynamicdrive.com/dynamicindex1/chrome/index.htm
... This is a .js which loads just fine, and works properly.
I'm also using a second .js which ain't working that well. The .js contains the following code:
function openOtherLinks(id1, id2) {
var link1 = document.getElementById(id1);
var link2 = document.getElementById(id2);
if(!link1.href || !link2.href)
return;
self.frames['left'].location.href = link2.href;
self.frames['main'].location.href = link1.href;
}
And the html heading contains among other things these lines:
<script type="text/javascript" src="java/meny.js"</script>
<script type="text/javascript" src="java/links.js"</script>
Where links.js contains the code i wrote above.
The links-script makes me able to make a "<a href" opening two targets at once, with each their targets (which in this case would be iframes).
Making parts of my html like this:
<a href="javascript: openOtherLinks('rotel1', 'rotel2')">Rotel</a>
<a href="javascript: openOtherLinks('tannoy1', 'tannoy2')">Tannoy</a>
... And the following anywhere outside the body:
<a id="tannoy1" href="tannoy_overview.html"></a>
<a id="tannoy2" href="tannoy_left.html"></a>
<a id="rotel1" href="rotel_overview.html"></a>
<a id="rotel2" href="rotel_left.html"></a>
Two examples of combinations I've trid:
http://www.risington.no/dynamikk/
- This one contains the links-script in the heading, and loads the dropmenu from the .js, which works out just fine in mozilla firefox and safari but NOT explorer. Tried out both 6.xx and 7.
http://www.risington.no/dynamikk/index2.html
- This one loads both the scripts external. But here the a href-part suddenly seems to be getting a slight problem. I'd believe it would be because of that the a hrefs is directed straight to a couple of tags in the script itself. But I'm far from no brain surgent when it comes to these kind of things.
1. Should the .js look different ? Or is this correct ?
2. Whenever I put the code in links.js directly in the heading of the html, it works but then it screws up the menu-script when the page is viewed in Explorer. (which was my problem at first).
3. Any ideas of how I could combine these scripts? Does it matter if I'm using them seperatly as .js-files or if I'm just putting it all directly into the heading? Is it ok to load one as an external js, as I put the other one in the heading?
Any help here would be awesome :=)