[dhtml] positioning probleem

Pagina: 1
Acties:

  • Pelle
  • Registratie: Januari 2001
  • Laatst online: 00:06

Pelle

🚴‍♂️

* Pelle ontbrakt

Wat was je vraag?

  • Hangloozz
  • Registratie: Juli 1999
  • Laatst online: 13-07 17:24

Hangloozz

{ @$%&# }

het antwoord is ja, maar wat was de vraag! :)

www.jurgroessen.nl


  • paragon
  • Registratie: April 2000
  • Laatst online: 10-09 05:50
Heel vaag ik heb gewoon gepoast?

Maar ik heb dus een functie om m'n content altijd in het midden van het beeld te plaatsen maar bij ns6.1 wil de pagina niet laden:
code:
1
2
3
4
function Test() { 
if (bw.ie5 || bw.ie55 ||bw.ie6) document.getElementById('position').style.posLeft = ((document.body.clientWidth/2)-380);
if (bw.ns6) document.getElementById('position').style.posLeft = 200px;
}

die 200px voor ns6 is gewoon om te testen.

zie http://paragonxls.xs4all.nl/NS6/

  • Dennis
  • Registratie: Februari 2001
  • Laatst online: 08:17
Probeer dit eens:
code:
1
if (bw.ns6) document.getElementById('position').style.left = 200px;

  • paragon
  • Registratie: April 2000
  • Laatst online: 10-09 05:50
Ik dacht dat het door een loadbar kwam, maar dat is het ook niet. Ik heb nu:
code:
1
2
3
4
function Test() { 
if (bw.ie5 || bw.ie55 ||bw.ie6) document.getElementById('position').style.posLeft = ((document.body.clientWidth/2)-380);
if (bw.ns6) document.getElementById('position').style.left = 200px;
}

Maar door de regel: if (bw.ns6)... krijg ik nu ook in IE een error en wordt er niet gepositioneerd.

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

Ik zal even kort een klein basisprincipe van if-then-else constructies toelichten:

Je doet hier een check of de browser IE 5 - 6 is. Daarna doe je nog een keer de check of de browser NS6 is. Maar het een sluit het ander uit. Gebruik dus else if bij de tweede if:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
f = document.getElementById; // wat minder typwerk :)

function Test() 
{
   if ( !f )
    return false;

   if ( bw.ie5 || bw.ie55 ||bw.ie6 ) 
    d ( 'position' ).style.posLeft = ( 
       document.body.clientWidth / 2 - 380 
    );
   else if (bw.ns6) 
    d ( 'position' ).style.left = 200px;
}

geen idee of dat je probleem oplost, maar dat zag ik eventjes tussendoor ;)

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


  • paragon
  • Registratie: April 2000
  • Laatst online: 10-09 05:50
Op maandag 08 oktober 2001 14:14 schreef drm het volgende:
Ik zal even kort een klein basisprincipe van if-then-else constructies toelichten:

Je doet hier een check of de browser IE 5 - 6 is. Daarna doe je nog een keer de check of de browser NS6 is. Maar het een sluit het ander uit. Gebruik dus else if bij de tweede if:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
f = document.getElementById; // wat minder typwerk :)

function Test() 
{
   if ( !f )
    return false;

   if ( bw.ie5 || bw.ie55 ||bw.ie6 ) 
    d ( 'position' ).style.posLeft = ( 
       document.body.clientWidth / 2 - 380 
    );
   else if (bw.ns6) 
    d ( 'position' ).style.left = 200px;
}

geen idee of dat je probleem oplost, maar dat zag ik eventjes tussendoor ;)
Maakt niks uit hij geeft nog steeds een error en positionering ho maar. Komt allemaal door die regel van ns6. Er wordt een object verwacht bij regel 16 en dat is de aanroep van Test()

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

mag ik even wat source zien waar dat object bw beschreven wordt?

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


  • paragon
  • Registratie: April 2000
  • Laatst online: 10-09 05:50
Op maandag 08 oktober 2001 15:19 schreef drm het volgende:
mag ik even wat source zien waar dat object bw beschreven wordt?
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function lib_bwcheck(){ //Browsercheck (needed)
    this.ver=navigator.appVersion
    this.agent=navigator.userAgent
    this.dom=document.getElementById?1:0
    this.opera5=this.agent.indexOf("Opera 5")>-1
    this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
    this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
    this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
    this.ie=this.ie4||this.ie5||this.ie6
    this.mac=this.agent.indexOf("Mac")>-1
    this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
    this.ns4=(document.layers && !this.dom)?1:0;
    this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
    return this
}
var bw=new lib_bwcheck()

Komt van dhtml central.

Ik heb even een kalere versie op http://www.xs4all.nl/~paragonx geplaatst omdat daar alles in de source staat. Deze werkt alleen in IE wat het positioneren aangaat.

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

• Consequent zijn in je code is wel makkelijk. Zet bijvoorbeeld overal een ; achter.
• dit werkt bij mij wel in Mozilla en NS 6.1 en IE:
code:
1
2
3
4
5
6
7
8
9
10
function Test() { 
if (bw.ie5 || bw.ie55 ||bw.ie6) {
    document.getElementById('position').style.left = ((document.body.clientWidth/2)-250);
    document.getElementById('position').style.top = ((document.body.clientHeight/2)-210);
    }
else if ( bw.ns6 ) {
   document.getElementById('position').style.top = '200px';
   document.getElementById('position').style.left = '200px';
}
}

:? ik begrijp eerlijk gezegd niet hoe je bij de property "posLeft" komt...
:? Het object bw heeft geen property ie55, kijk maar in de function lib_bwcheck

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz


  • wicher|IA
  • Registratie: November 2000
  • Laatst online: 10-04-2023
je weet trouwens dat er voor het content-altijd-in-het-midden-plaatsen ook de center-tag is? :P

  • drm
  • Registratie: Februari 2001
  • Laatst online: 09-06-2025

drm

f0pc0dert

Op dinsdag 09 oktober 2001 09:58 schreef wicher het volgende:
je weet trouwens dat er voor het content-altijd-in-het-midden-plaatsen ook de center-tag is? :P
|:( doe eerst eens in de source kijken voordat je gaat blaten.

Music is the pleasure the human mind experiences from counting without being aware that it is counting
~ Gottfried Leibniz

Pagina: 1