Toon posts:

[JS] Javascript en Firefox probleem.

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hey,

Iemand een idee waarom het volgend javascriptje dat door een swf wordt aangeroepen het in firefox niet doet...?

code:
1
2
3
4
function td_hideLayer(){
    flash.visibility='hidden';
    void(null);
}


Alvast bedankt voor jullie hulp!

  • BtM909
  • Registratie: Juni 2000
  • Niet online

BtM909

Watch out Guys...

Omdat je referentie niet helemaal compleet is :? ;)

code:
1
2
3
4
function td_hideLayer(){
    document.getElementById('flash').style.visibility='hidden';
//    void(null); <- is niet eens nodig?
}


edit:

André, p0wned >:)

[ Voor 28% gewijzigd door BtM909 op 09-11-2004 16:04 ]

Ace of Base vs Charli XCX - All That She Boom Claps (RMT) | Clean Bandit vs Galantis - I'd Rather Be You (RMT)
You've moved up on my notch-list. You have 1 notch
I have a black belt in Kung Flu.


  • André
  • Registratie: Maart 2002
  • Laatst online: 18-05 16:30

André

Analytics dude

Omdat FF waarschijnlijk niet weet wat flash is? Is het een referentie naar een id ofzo? Wat voor object is 'flash'?

[ Voor 6% gewijzigd door André op 09-11-2004 15:52 . Reden: eeeeeeeeeeeej, ik eerst ]


  • D-RiSe
  • Registratie: September 2000
  • Laatst online: 19-03 19:37

D-RiSe

Kick the baby

doe maar
code:
1
document.getElementById('flash').style.display='none';

intel silver reef, celly 2.0 Ghz, 256mb ddr, G2MX


Verwijderd

Topicstarter
Dit is nu de volledige code:

code:
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<script type="text/JavaScript">
<!--
 function verifyBrowser(){ 
    this.ver=navigator.appVersion;
    var agent = navigator.userAgent.toLowerCase(); 
    this.os =navigator.platform ;
    this.dom=document.getElementById?1:0 
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0; 
    this.ie4=(document.all && !this.dom)?1:0; 
    this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ie6=this.ver.indexOf("MSIE 6")>-1 && this.dom?1:0;
    this.win = (agent.indexOf("win")!=-1);
    this.ns4=(document.layers && !this.dom)?1:0; 
    this.bw=(this.ie5 || this.ie4 || this.ie6 || this.ns4 || this.ns5 || this.ie6)
    return this 
} 
var is = new verifyBrowser(); 

function layerObject(id,visibility) {
    if (is.ie5||is.ns6 ||is.ie6){
        this.obj = document.getElementById(id).style;
        this.obj.visibility = visibility;
        return this.obj;
    } else if(is.ie4) {
        this.obj = document.all[id].style;
        this.obj.visibility = visibility;
        return this.obj;
    } else if(is.ns4) {
        this.obj = document.layers[id];
        this.obj.visibility = visibility;
        return this.obj;
    } 
}

function layerSetup() {
    flash   = new layerObject('flashDiv','visible');
}

function HOOFDVOGEL(){
    layerSetup();
}

function td_hideLayer(){
document.getElementById('flash').style.display='none';
}

window.onload = HOOFDVOGEL;

//-->
</script>

</head>
<body>
<div id="flashDiv" style="position:absolute;visibility:visible;height:550;width:450;z-index:99;left:100;top:80">
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
 codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0"
 WIDTH="550" HEIGHT="450" id="sun_01" ALIGN="">

 <PARAM NAME=movie VALUE="sun_nl.swf?clickTag=http://www.HOOFDVOGEL-ournature.be/nl"> 
 <PARAM NAME=quality VALUE=high><EMBED src="sun_nl.swf?clickTag=http://www.HOOFDVOGEL-ournature.be/nl" quality=high WIDTH="550" HEIGHT="450" NAME="sun_01" ALIGN=""
 TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>
</div>



Still no workee...

Nogmaals bedankt voor de hulp :)

  • crisp
  • Registratie: Februari 2000
  • Laatst online: 16:00

crisp

Devver

Pixelated

JavaScript:
1
2
3
alert(is.ie5); // 0
alert(is.ie6); // 0
alert(is.ns6); // undefined

Firefox 1.0

Je probleem is dus dat je browsercheck zuigt. Daarbij zijn browserchecks wel zo 90's en hedentendage totaal overbodig. Wil je persé toch ns4 en ie4 ondersteunen doe dan gewoon dit en sloop die hele browsercheck er uit:

JavaScript:
1
2
3
4
5
6
7
if (document.getElementById) {
  // any modern browser can handle DOM
} else if (document.all) {
  // IE4 object model
} else if (document.layers) {
  // NS4 object model
}

Intentionally left blank

Pagina: 1