Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Problem ze zgodnością XHTML 1.0 w skrypcie sondy
Forum PHP.pl > Forum > Po stronie przeglądarki > HTML \ XHTML
kamil881
Witam!
Na stronie mam skrypt sondy. Od rana męczę się z poprawianeiem błędów. Było 58, a teraz jest 3 i nie wiem jak poprawić.

Kod:
Kod
<!--
//  |=====================================================================|
//  || IM Sonda v1.5                                                     ||
//  || Szanuj prawa autorskie i nie usuwaj tych informacji!              ||
//  || W razie problemów proszę wejść na adres: "www.IMaster.prv.pl"     ||
//  |=====================================================================|
-->
<script type="text/javascript">
function wyniki(url, width, height) {
var Win = window.open(url,"pokaz",'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' )
}
</script>
<?
if (file_exists("$sondapath/config/poll_options.ict") && file_exists("$sondapath/config/config.ict") && file_exists("$sondapath/poll_view/sonda_view.ict") && file_exists("$sondapath/config/poll_config.ict") && file_exists("$sondapath/config/poll_title.ict")) {
$config_plik=file("$sondapath/config/config.ict");
foreach ($config_plik as $confy) {
$confy=explode("||", $confy);
}
$title_plik=file("$sondapath/config/poll_title.ict");
foreach ($title_plik as $title) {
$title=explode("||", $title);
}
$pconf_plik=file("$sondapath/config/poll_config.ict");
foreach ($pconf_plik as $pconf) {
$pconf=explode("||", $pconf);
}
$poptions_plik=file("$sondapath/config/poll_options.ict");
foreach ($poptions_plik as $poptions) {
$poptions=explode("||", $poptions);
}
$sview_plik=file("$sondapath/poll_view/sonda_view.ict");
foreach ($sview_plik as $s_view) {
$s_view=explode("||", $s_view);
}


echo "<form action=\"$sondapath/czekaj.php\" target=\"pokaz\" method=\"post\" onSubmit=\"javascript:wyniki('$sondapath/czekaj.php',$confy[5],$confy[6]);\">";
echo "</form>";
echo "<table border=\"0\" cellspacing=\"0\" width=\"$s_view[3]\" height=\"$s_view[4]\" cellpadding=\"$s_view[18]\" style=\"border: $s_view[13] $s_view[14] $s_view[15]; font-family: $s_view[0]; font-size: $s_view[1]; color: $s_view[2];\" align=\"$s_view[5]\" >";
echo "<tr><td bgcolor=\"$s_view[16]\" align=\"$s_view[6]\" valign=\"$s_view[10]\" style=\"border-bottom: $s_view[13] $s_view[14] $s_view[15];\">$title[0]</td></tr>";
echo "<tr><td bgcolor=\"$s_view[17]\" width=\"100%\" align=\"$s_view[7]\" valign=\"$s_view[11]\">";
echo "<input type=\"radio\" name=\"odp\" value=\"0\" checked=\"on\"/>&nbsp;$poptions[0]<br />";
for ($i=1; $i<$pconf[0]; $i++){
echo "<input type=\"radio\" name=\"odp\" value=\"$i\" style=\"border-top: 0px;\"/>&nbsp;$poptions[$i]<br />";
}
echo "</td></tr>";
echo "<tr><td bgcolor=\"$s_view[17]\" align=\"$s_view[8]\" valign=\"$s_view[12]\">
<input type=\"submit\" name=\"sonda_submit\" value=\"Głosuj!\"/>
</td></tr>";
echo "<tr><td bgcolor=\"$s_view[17]\" align=\"$s_view[8]\" valign=\"$s_view[12]\">
<a href=\"javascript:wyniki('$sondapath/wyniki.php',$confy[5],$confy[6])\">Aktualne wyniki</a>
</td></tr>";
//Jeśli usuniesz poniższy fragment złamiesz prawa autorskie. Uszanuj pracę innych!!!
echo "<tr><td bgcolor=\"$s_view[17]\" align=\"right\" valign=\"bottom\" style=\"font-family: $s_view[0]; font-size: $s_view[1]; color: $s_view[2];\"></td></tr>";
echo "</table>";  
}
else {
echo "<center>Sonda nie została skonfigurowana lub nie został ustawiony jej wygląd!<br />idĽ do <a href=\"$sondapath/admin.php\">panelu administracyjnego</a></center>";
}
?>


Validator zwraca:
Cytat
  1. Line 108, Column 69: there is no attribute "onSubmit".…arget="pokaz" method="post" onSubmit="java script:wyniki('poll/czekaj.php',500

    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

    This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

    How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
  2. Line 108, Column 177: there is no attribute "height".…" cellspacing="0" width="175" height="150" cellpadding="5" style="border: 1px

    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

    This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

    How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.
  3. Line 108, Column 560: value of attribute "checked" cannot be "on"; must be one of "checked".…dio" name="odp" value="0" checked="on"/>&nbsp;September (2004)<br /><input ty

    The value of the attribute is defined to be one of a list of possible values but in the document it contained something that is not allowed for that type of attribute. For instance, the “selected” attribute must be either minimized as “selected” or spelled out in full as “selected="selected"”; a value like “selected="true"” is not allowed.


Z góry dziękuję za pomoc i pozdrawiam!
Crozin
w XHTML atrybuty piszemy małymi litareami (onsubmit)
checked="checked" - nie checked="on"
W XHTML element <table> nie posiada atrybutu height
nevt
znasz angielski? znasz składnię XHTML ? masz dostęp do odpowiedniego manuala ?

przecież wszystkie błędy masz przecież ładnie opisane w wynikach walidacji ...

1. W XHTML nie ma atrybutu onSubmit, jest onsubmit (nazwy wszystkich atrybutów pisane są wyłącznie małymi literami)

2. Znacznik <table> nie ma atrybutu height ... (dlatego, że wysokość tabeli jest sumą wysokości jej wierszy... ), jeżli już musisz ustawić na sztywno height dla całej tabeli, to do atrybutu style dodaj: "height:100px;display:block"

3. atrybut checked może przyjąć tylko wartość "checked", czyli jeżeli chcesz domyslnie zaznaczyć, wstawiasz checked="checked" a jeżeli nie - to w ogóle nie dodajesz atrybutu checked

powodzenia.

EDIT: Crozin był szybszy smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.