login  Naam:   Wachtwoord: 
Registreer je!
 Forum

code werkt niet

Offline jeanke1122 - 08/07/2007 15:42
Avatar van jeanke1122Nieuw lid Hallo,

ik zit met een vervelend probleem. Ik heb een intro gevonden op het internet, uiteraard javascript. Nu wilt deze intro niet werken, omdat helemaal bovenaan in de html pagina de xhtml standard staat:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


Als je het uitroepteken uit <!DOCTYPE html weghaalt, werkt het wel:s

Dit is mijn volledige index pagina:

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  4.  
  5. <head>
  6. <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
  7. <script src="includes/menu.js" type="text/javascript"></script>
  8.  
  9. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  10. <link href="includes/screen.css" rel="stylesheet" type="text/css" media="screen" />
  11. <!--[if IE 7]><link rel="stylesheet" type="text/css" href="includes/screen_ie7.css" /><![endif]-->
  12. <title>Titel</title>
  13.  
  14. </head>
  15. <body>
  16.  
  17. <script type="text/javascript">
  18.  
  19. var width=document.body.clientWidth;
  20. var height=document.body.clientHeight;
  21.  
  22. function doClickText(who,type,step,timeOut) {
  23. document.getElementById(who).style.display="none";
  24. if(type==0) {
  25. reveal('revealDiv1',step,timeOut,0);
  26. reveal('revealDiv2',step,timeOut,1);}
  27. if(type==1) {
  28. reveal('revealDiv1',step,timeOut,2);
  29. reveal('revealDiv2',step,timeOut,3);}}
  30.  
  31. //////////////////////
  32. // Reveal! function //
  33. //////////////////////
  34. function reveal(who,step,timeOut,type) {
  35. if(type==0)
  36. var where="top";
  37. if(type==1)
  38. var where="bottom";
  39. if(type==2)
  40. var where="left";
  41. if(type==3)
  42. var where="right";
  43. eval('var temp=document.getElementById(who).style.'+where);
  44. temp=parseInt(temp);
  45. if(type==0||type==1)
  46. var checkWith=height/2;
  47. if(type==2||type==3)
  48. var checkWith=width/2;
  49. if(-temp<checkWith) {
  50. temp-=step;
  51. eval('document.getElementById(who).style.'+where+'=temp;');
  52. setTimeout("reveal('"+who+"',"+step+",'"+timeOut+"',"+type+")", timeOut);}
  53. else {
  54. document.getElementById(who).style.display="none";
  55. document.body.scroll="yes";}}
  56.  
  57. function initReveal(type,div1bg,div2bg,div1bw,div2bw,div1bc,div2bc,step,timeOut,click) {
  58. if(type==0) {
  59. var bWhere1="border-bottom";
  60. var bWhere2="border-top";
  61. var putZero1="top:0px; left:0px";
  62. var putZero2="bottom:0px; left:0px";
  63. document.write('<div id="revealDiv1" style="z-index:100; display:block; position:absolute; '+putZero1+'; background:'+div1bg+' ; width:'+(width)+'; height:'+(height/2)+'; '+bWhere1+':'+div1bc+' solid '+div1bw+'px"></div>');
  64. document.write('<div id="revealDiv2" style="z-index:100; display:block; position:absolute; '+putZero2+'; background:'+div2bg+' ; width:'+(width)+'; height:'+(height/2)+'; '+bWhere2+':'+div2bc+' solid '+div2bw+'px"></div>');
  65. if(!click) {
  66. reveal('revealDiv1',step,timeOut,0);
  67. reveal('revealDiv2',step,timeOut,1);}
  68.  
  69. else {
  70. clickText(type,step,timeOut);}}
  71.  
  72. if(type==1) {
  73. var bWhere1="border-right";
  74. var bWhere2="border-left";
  75. var putZero1="top:0px; left:0px";
  76. var putZero2="top:0px; right:0px";
  77. document.write('<div id="revealDiv1" style="z-index:100; display:block; position:absolute; '+putZero1+'; background:'+div1bg+' ; width:'+(width/2)+'; height:'+(height)+'; '+bWhere1+':'+div1bc+' solid '+div1bw+'px"></div>');
  78. document.write('<div id="revealDiv2" style="z-index:100; display:block; position:absolute; '+putZero2+'; background:'+div2bg+' ; width:'+(width/2)+'; height:'+(height)+'; '+bWhere2+':'+div2bc+' solid '+div2bw+'px"></div>');
  79. if(!click) {
  80. reveal('revealDiv1',step,timeOut,2);
  81. reveal('revealDiv2',step,timeOut,3);}
  82. else {
  83. clickText(type,step,timeOut);}}
  84. function clickText(type,step,timeOut) {
  85. document.write('<div id="clickText" style="z-index:101; display:block; position:absolute; top:'+(height/2-clickh/2-clickb)+'; left:'+(width/2-clickw/2-clickb)+'"><table style="border:'+clickc+' solid '+clickb+'px; background:'+clickbg+' ;width:'+clickw+'px; height:'+clickh+'; '+clickFont+'; cursor:hand; cursor:pointer" onClick="doClickText(\'clickText\','+type+','+step+','+timeOut+')"><tr><td align="middle">'+clickt+'</td></tr></table></div>');}}
  86. </SCRIPT>
  87.  
  88. <SCRIPT>
  89. /*
  90. The following is required only if you
  91. want the user to click to reveal the page
  92. */
  93. var clickw=150; // Width
  94. var clickh=20; // Height
  95. var clickb=2; // Border width
  96. var clickc="#000000"; // Border color
  97. var clickbg="#000000"; // Background color
  98. var clickt="Klik hier!"; // Text to display
  99. var clickFont="font-family:verdana,arial,helvetica; font-size:10pt; font-weight:bold; color:#FFFFFF"; // The font style of the text
  100.  
  101. new initReveal(0,'#CCCCCC','#CCCCCC',1,1,'#000000','#000000',3,10,true);
  102. </script>
  103.  
  104. <!-- content v/d site !-->
  105.  
  106.  
  107. </body>
  108. </html>


iemand raad?

6 antwoorden

Gesponsorde links
Offline bertmelis - 08/07/2007 15:47 (laatste wijziging 08/07/2007 15:50)
Avatar van bertmelis PHP interesse
Citaat:
xhtml standard


Haal je site eens door de validator van het w3c. Als je alle foutmeldingen hebt weggewerkt, en het probleem is nog niet opgelost wil ik wel verder zoeken.

http://validator.w3.org
Offline jeanke1122 - 08/07/2007 16:36 (laatste wijziging 08/07/2007 17:03)
Avatar van jeanke1122 Nieuw lid ja, hopen errors bij het script.. maar die krijg ik niet weg:s de site zelf is valid.
Offline MFdriver - 08/07/2007 19:36
Avatar van MFdriver PHP interesse javascript hoort in een appart bestand te staan!
vb: js.js ofzo
die moet je dan includen in de je index pagina.. zo gaat ie terug valid worden in ieder geval..
Offline bertmelis - 08/07/2007 19:38
Avatar van bertmelis PHP interesse
  1. <script type="text/javascript">
  2. <!--
  3. javascript code hier
  4. //-->
  5. </script>

alle html-tags in kleine letters, geen hoofdletters
...
Offline jeanke1122 - 08/07/2007 20:58
Avatar van jeanke1122 Nieuw lid @MFdriver: ja, dit heb ik gedaan, zo wordt het idd valid.

@bertmelis: alles in het klein gezet, zelfs tussen de <!-- //-->, maar helaas zonder resultaat:'(
Offline zointer - 09/07/2007 06:58 (laatste wijziging 09/07/2007 07:03)
Avatar van zointer HTML gevorderde Haal die javascript rommel eerst eens van tussen je body tag en controleer je code je zal zien dat die goed is.

De fout zit hem in het javascript.

Waar heb je die javascript code vandaan????

En met welke browser bekijk je het???


[edit]is het deze http://javascri...eveal.html[edit]
Gesponsorde links
Dit onderwerp is gesloten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.2s