Archivlink: javarea.de Forum > JavaScript > div verbergen wenn datei in anderem frame
Vollständigen Link anzeigen: javarea.de Forum > JavaScript > div verbergen wenn datei in anderem frame
Pages: [1]
| geschrieben von ju7035 am 19.07.2011 - 10:15 |
hallo zusammen,
ich hab schon versucht aus anderen beiträgen mein problem zu lösen, aber dafür reicht mein javascript-können leider nicht aus...
vielleicht könnt ihr mir ein beispiel verlinken, wo sowas schonmal gelöst worden ist, was ich brauch...
ich hab eine html-site bisher ohne frames, nun soll aber in einem 0px-frame hintergrundmusik laufen. in diesen frame lad ich entweder eine html mit musik, oder eine ohne, die buttons hierfür in meiner hauptseite sollen aber entsprechend angezeigt oder verborgen werden: "ton an", wenn musik aus ist und andersrum...
hier mal der code, den ich bisher hab (zum testen bisher nur leere seiten):
frameset:
| HTML-Quelltext | 1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
| <head>
<title>frameset</title>
</head>
<frameset rows="100%,80" frameborder="no" border="0" framespacing="0" >
<frame src="inhalt1.html" name="main" scrolling="no" noresize="noresize" id="questmain" title="mainFrame"/>
<frame src="musik.html" name="musik" scrolling="No" noresize="noresize" id="musik" title="frame2" />
</frameset>
<noframes><body>
</body></noframes>
</html> |
inhalt1.html:
| HTML-Quelltext | 1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
| <head>
<title>frame1</title>
<script type="text/javascript">
<!--
function Verstecken()
{
with (document)
{
getElementById("anknopf").style.visibility = (seite == 'musik.html') ? 'hidden' : 'visible';
musik.location.href = './' + seite;
}
}
//-->
</script>
</head>
<body onload="Verstecken()">
<div id="ausknopf"><p><a href="musikaus.html" target="musik">musik aus</a></p></div>
<div id="anknopf"><p><a href="musik.html" target="musik">musik an</a></p></div>
</body>
</html> |
musik.html:
| HTML-Quelltext | 1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
| <html>
<head>
<title>Hintergrundmusik</title>
<!-- Microsoft: -->
<bgsound src="musik.mp3" loop="infinite">
</head>
<body>
<!-- Netscape: -->
<embed src="musik.mp3" autostart="true" loop="true" hidden="true" height="0" width="0">
<h1>musik</h1>
</body>
</html> |
ihr seht, da is noch nicht viel da, aber ich wär für jede hilfe dankbar, bitte einfach erklären, ich bin absoluter abfänger!
danke schonmal, grüße, julia |
| geschrieben von ju7035 am 19.07.2011 - 12:06 |
hallo nochmal,
jetzt hab ich was gebastelt mit viel glück, das funktioniert auch, aber braucht irgendwie lange, und ich hab angst, wenn ichs in meine seite einbaue, dann funktionierts nicht mehr...
könnte man das sinnvoll vereinfachen?
inhalt1.html:
| HTML-Quelltext | 1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
| <head>
<title>frame1</title>
<script type="text/javascript">
<!--
document.getElementById("FirstID").style="display:none";
function wegan(objId,x,theProp,theValue) { //v9.0
var obj = null; with (document){ if (getElementById)
obj = getElementById(objId); }
if (obj){
if (theValue == true || theValue == false)
eval("obj.style."+theProp+"="+theValue);
else eval("obj.style."+theProp+"='"+theValue+"'");
}
}
function wegaus(objId,x,theProp,theValue) { //v9.0
var obj = null; with (document){ if (getElementById)
obj = getElementById(objId); }
if (obj){
if (theValue == true || theValue == false)
eval("obj.style."+theProp+"="+theValue);
else eval("obj.style."+theProp+"='"+theValue+"'");
}
}
function MM_changeProp(objId,x,theProp,theValue) { //v9.0
var obj = null; with (document){ if (getElementById)
obj = getElementById(objId); }
if (obj){
if (theValue == true || theValue == false)
eval("obj.style."+theProp+"="+theValue);
else eval("obj.style."+theProp+"='"+theValue+"'");
}
}
//-->
</script>
</head>
<body >
<div id="ausknopf"><p><a href="musikaus.html" target="musik" onclick="MM_changeProp('anknopf','','visibility','visible','DIV')">musik aus</a></p></div>
<div id="anknopf" ><p><a href="musik.html" target="musik" onclick="MM_changeProp('ausknopf','','visibility','visible','DIV')">musik an</a></p></div>
</body>
</html> |
unterer frame:
musik.html:
| HTML-Quelltext | 1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
| <html>
<head>
<title>Hintergrundmusik</title>
<!-- Microsoft: -->
<bgsound src="musik.mp3" loop="infinite">
</head>
<body onLoad="parent.main.wegan('anknopf','','visibility','hidden','DIV')">
<!-- Netscape: -->
<embed src="musik.mp3" autostart="true" loop="true" hidden="true" height="0" width="0">
<p >musik</p>
</body>
</html> |
danke schonmal, grüße, julia |
| geschrieben von ju7035 am 19.07.2011 - 12:25 |
| tut mir leid, ich schonwieder, das war doch nix, das funktioniert nur, wenn der untere frame neu geladen wird, aber der button soll ja beim laden der datei im oberen frame wissen, ob er sichtbar oder unsichtbar sein soll...??? |
|