Probleempje met doctype

Status
Niet open voor verdere reacties.

knetter3

Gebruiker
Lid geworden
5 apr 2008
Berichten
56
Heb een scriptje gemaakt om kleur te kunnen wijzigen. Werkte goed, totdat ik deze doctype erbij zette (nodig voor css):
HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

De javascript code:
Code:
  function show_bericht(zap) {
   if (document.getElementById) {
   var abra = document.getElementById(zap).style;
    if (abra.display == "none") {
    abra.display = "block";
    } else {
    abra.display = "none";
   }
   return false;
   } else {
   return true;
  }
  }
  
  function delete_bericht(zap) {
   if (document.getElementById) {
   var abra = document.getElementById(zap).style;
    abra.display = "none";
   return false;
   } else {
   return true;
  }
  }
  

function color  (colorvar, naam)
{
document.getElementById(naam).value= colorvar;
document.getElementById(naam).style.backgroundColor= colorvar;
document.getElementById(naam).style.color= colorvar;
}
function show (naam, safenaam)
{

document.write('<input id="'+ safenaam +'" type="text" name="'+ safenaam +'" value="Voer een kleur in"><input type="button" onclick="show_bericht(\''+ naam +'\');" id="login" value="'+ naam +'" >');

}

function setcolor(kleur, naam)
{
color(kleur, naam);
}
function colorselect(kleur, safenaam, naam)
{
document.write("<a href='#' style='background-color: "+ kleur +"; color:"+ kleur +"; border: 1px solid black; width: 25px; height: 25px;' onclick= \" color('"+ kleur +"', '"+ safenaam +"'); delete_bericht('"+ naam +"');\"></a>");
}
function colorsystem (naam, safenaam)
 {
show (naam, safenaam);



document.write("<div id='"+ naam +"' style='display: none' class='colorbox'>");

colorselect("#FFFF00", safenaam, naam);
colorselect("#FF00FF", safenaam, naam);
colorselect("#FF0000", safenaam, naam);
colorselect("#00FFFF", safenaam, naam);
colorselect("#00FF00", safenaam, naam);
colorselect("#0000FF", safenaam, naam);
document.write("<br>");
colorselect("808000", safenaam, naam);
colorselect("800080", safenaam, naam);
colorselect("800000", safenaam, naam);
colorselect("008080", safenaam, naam);
colorselect("008000", safenaam, naam);
colorselect("000080", safenaam, naam);
document.write("<br>");
colorselect("#FFFFFF", safenaam, naam);
colorselect("000000", safenaam, naam);
colorselect("808080", safenaam, naam);
colorselect("C0C0C0", safenaam, naam);
document.write("</div>");
}

volgens mij zit het probleem hierin:
Code:
document.write("<a href='#' style='background-color: "+ kleur +"; color:"+ kleur +"; border: 1px solid black; width: 25px; height: 25px;' onclick= \" color('"+ kleur +"', '"+ safenaam +"'); delete_bericht('"+ naam +"');\"></a>");
Als ik met doctype op de button click, zie ik niks
Kan iemand mij helpen?
 
Laatst bewerkt:
Volgens mij is style een readonly object. Probeer dit eens:
Code:
var abra = document.getElementById(zap);
abra.style.display = "block";
 
Dit gedeelte werkt wel. Hij schuift wel uit, maar hij laat geen kleurenblokjes zien
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan