Jivanmukta
2018-11-11 20:49:18 UTC
Napisałem:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="pl">
<head>
...
<script type="text/javascript">
$(document).ready(function () {
...
// tu przypisania funkcji submitForm i animateMainTitle
...
});
</script>
</head>
...
<body>
...
<table id="top" border="0">
<caption><h1 id="main_title">...</h1></caption>
...
</table>
...
<form action="http://localhost/~robert/announcement/insert"
id="announcement" name="announcement" enctype="multipart/form-data"
method="post" accept-charset="utf-8">
...
<div id="property_pictures_field">
...
<input multiple='multiple' type='file' id='property_pictures'
name='property_pictures[]' class='multi'
accept='gif|jpg|jpeg|jpe|bmp|png|gif87|gif89a|mpg|mpeg|mpe|mov|avi|wmv|vob|ogm|ogv'
value='Wybierz plik' tabindex='61'> </div>
...
</div>
...
</form>
...
</body>
</html>
Czasami mam błędy JavaScript w konsoli przeglądarki (testowałem pod
FireFoxem, Operą, Chrome):
function submitForm() {
...
alert(document.getElementById("property_pictures_field")); // OK
var pp = document.getElementById("property_pictures").value; //
CZASAMI BŁĄD: getElementById JEST null
...
}
function animateMainTitle() {
...
mainTitle = document.getElementById("main_title").innerHTML; //
CZASAMI BŁĄD: getElementById JEST null
...
}
Pliki .html, .css, .js przechodzą pomyślnie walidację.
Nie mam innego elementu o id='property_pictures' ani innego o
id="main_title", literówki w id nie ma.
DOM dokument jest załadowany w chwili wywołania.
Nie usuwam elementów property_pictures ani main_title przy pomocy
JavaScript.
Przejrzałem w Google strony "getElementById returns null" i nie
znalazłem przyczyny mojego błędu.
Prosiłbym o podpowiedź co robię źle.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="pl">
<head>
...
<script type="text/javascript">
$(document).ready(function () {
...
// tu przypisania funkcji submitForm i animateMainTitle
...
});
</script>
</head>
...
<body>
...
<table id="top" border="0">
<caption><h1 id="main_title">...</h1></caption>
...
</table>
...
<form action="http://localhost/~robert/announcement/insert"
id="announcement" name="announcement" enctype="multipart/form-data"
method="post" accept-charset="utf-8">
...
<div id="property_pictures_field">
...
<input multiple='multiple' type='file' id='property_pictures'
name='property_pictures[]' class='multi'
accept='gif|jpg|jpeg|jpe|bmp|png|gif87|gif89a|mpg|mpeg|mpe|mov|avi|wmv|vob|ogm|ogv'
value='Wybierz plik' tabindex='61'> </div>
...
</div>
...
</form>
...
</body>
</html>
Czasami mam błędy JavaScript w konsoli przeglądarki (testowałem pod
FireFoxem, Operą, Chrome):
function submitForm() {
...
alert(document.getElementById("property_pictures_field")); // OK
var pp = document.getElementById("property_pictures").value; //
CZASAMI BŁĄD: getElementById JEST null
...
}
function animateMainTitle() {
...
mainTitle = document.getElementById("main_title").innerHTML; //
CZASAMI BŁĄD: getElementById JEST null
...
}
Pliki .html, .css, .js przechodzą pomyślnie walidację.
Nie mam innego elementu o id='property_pictures' ani innego o
id="main_title", literówki w id nie ma.
DOM dokument jest załadowany w chwili wywołania.
Nie usuwam elementów property_pictures ani main_title przy pomocy
JavaScript.
Przejrzałem w Google strony "getElementById returns null" i nie
znalazłem przyczyny mojego błędu.
Prosiłbym o podpowiedź co robię źle.