- Joined
- Nov 23, 2019
- Messages
- 72
- Reaction score
- 1
I returned back (from DOM to objects and would see one very simple sample in real application but that is not running as I expect or understand.
see that sample here:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> javascript simple sample</title>
<script>
var hotel = {
name: 'park',
rooms: 77,
booked: 34,
salinta: function() {
return this.rooms - this.booked;
}
};
var elName = document.getElementById('hotelName');
elName.textContent = hotel.name;
var elRooms = document.getElementById('rooms');
elRooms.textContent = hotel.salinta();
</script>
</head>
<body>
<div id="hotelName"></div>
<div id="rooms"></div>
</body>
</html>
but more than the sample,I think I should be able to check the validation of such files (or only js files). when I check this html form W3C validation,it returns no error,but it is not running.
see that sample here:
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> javascript simple sample</title>
<script>
var hotel = {
name: 'park',
rooms: 77,
booked: 34,
salinta: function() {
return this.rooms - this.booked;
}
};
var elName = document.getElementById('hotelName');
elName.textContent = hotel.name;
var elRooms = document.getElementById('rooms');
elRooms.textContent = hotel.salinta();
</script>
</head>
<body>
<div id="hotelName"></div>
<div id="rooms"></div>
</body>
</html>
but more than the sample,I think I should be able to check the validation of such files (or only js files). when I check this html form W3C validation,it returns no error,but it is not running.
Last edited: