/    Sign up×
Community /Pin to ProfileBookmark

HTML5 or Javascript

Hi! I started a course for HTML5 basics.

I know a little about DOM an know that you can use Javascript to access and change elements.

In the HTML5-course they use this code (can’t see all because I use the trial-account at PluralSight)

[CODE]var items = document.getElementsByClassName(“example”), log = document.getElementsById(‘log’);

log.innerText = items.length + ‘ “Item” + elements’;[/CODE]

The teacher says that this is pure HTML5.

So my questions:

If it is pure HTML5, when should I use this and when should I use Javascript or other?

I guess that items are an array? Could someone explain the code in detail?

You cant use variables in HTML5, or can you?

to post a comment
HTML

10 Comments(s)

Copy linkTweet thisAlerts:
@cootheadFeb 20.2016 — Hi there net777,

[indent]

and a warm welcome to these forums. ?

If [color=navy][i]"PluralSight"[/i][/color] advocate the [color=navy][i]"innerText"[/i][/color] object, look elsewhere for tuition.

The [color=navy][i]"innerText"[/i][/color] object was introduced by Microsoft and is not a W3C standard.

It's implementation varies across browsers, and some may render it.

Importantly though, the Firefox browser does not support [color=navy][i]"innerText"[/i][/color] at all.

[color=navy]The teacher says that this is pure HTML5.[/color][/quote]
No, [color=navy][i]"Javascript"[/i][/color] is [color=navy][i]"Javascript"[/i][/color] and [color=navy][i]"HTML"[/i][/color] is [color=navy][i]"HTML"[/i][/color].

The former may be used to manipulate the latter. ?

As for [color=navy][i]"Javascript"[/i][/color] tuition, try this site...

[indent][url=http://javascriptexample.net/]JavaScript By Example[/url][/indent]

The author - ( [b]felgall[/b] ) - is well known contributor at many coding forums.

[/indent]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@net777authorFeb 20.2016 — Hi there net777,

[indent]

and a warm welcome to these forums. ?

If [color=navy][i]"PluralSight"[/i][/color] advocate the [color=navy][i]"innerText"[/i][/color] object, look elsewhere for tuition.

The [color=navy][i]"innerText"[/i][/color] object was introduced by Microsoft and is not a W3C standard.

It's implementation varies across browsers, and some may render it.

Importantly though, the Firefox browser does not support [color=navy][i]"innerText"[/i][/color] at all.


No, [color=navy][i]"Javascript"[/i][/color] is [color=navy][i]"Javascript"[/i][/color] and [color=navy][i]"HTML"[/i][/color] is [color=navy][i]"HTML"[/i][/color].

The former may be used to manipulate the latter. ?

As for [color=navy][i]"Javascript"[/i][/color] tuition, try this site...

[indent][url=http://javascriptexample.net/]JavaScript By Example[/url][/indent]

The author - ( [b]felgall[/b] ) - is well known contributor at many coding forums.

[/indent]

[i]coothead[/i][/QUOTE]



Ok...

First of all, thanks for the welcome!

I also apologize for bad english as I am swedish.

The thing is that I might have a jobb teaching beginners some courses.

Since I know quite alot about webbdevelopement - although mostly backend- I thought I could give it a go.

The students were also to follow course at Pluralsight so I thought I could go through the courses in advance to close the gaps.

The HTML5-course were alot more complicated than I expected.

I know some about DOM and that you can manipulate it using javascript. But the author seemed to propose that you could use methods built into HTML5.

Most confusing.
Copy linkTweet thisAlerts:
@cootheadFeb 20.2016 — Hi there net777,

[indent]

There is nothing wrong with your English that I am aware of. ?

I cannot say the same about mine though. ?

[color=navy]The students were also to follow course at Pluralsight[/color][/quote]

I can see no good reason to pay for [color=navy][i]"HTML"[/i][/color] or [color=navy][i]"HTML"[/i][/color] tuition,

especially from a site that blatantly advocates bad practices.

There are plenty of free tutorials online from which to choose.

[color=navy]But the author seemed to propose that you could use methods built into HTML5.[/color][/quote]
No, [color=navy][i]"HTML"[/i][/color] is not and never will be dynamic.

Are you certain that is what the author proposed?

If so, look elsewhere for more reliable information. ?

[/indent]
Copy linkTweet thisAlerts:
@net777authorFeb 20.2016 — Hi there net777,

[indent]

There is nothing wrong with your English that I am aware of. ?

I cannot say the same about mine though. ?

I can see no good reason to pay for [color=navy][i]"HTML"[/i][/color] or [color=navy][i]"HTML"[/i][/color] tuition,

especially from a site that blatantly advocates bad practices.

There are plenty of free tutorials online from which to choose.


No, [color=navy][i]"HTML"[/i][/color] is not and never will be dynamic.

Are you certain that is what the author proposed?

If so, look elsewhere for more reliable information. ?

[/indent][/QUOTE]


No, I'm not sure that is what he meant. I'll try to get him to clarify it.

Unfortunately it seems that the company behind the courses seems to want to use this site.
Copy linkTweet thisAlerts:
@cootheadFeb 20.2016 — Hi there net777,

[indent]
[color=navy]Unfortunately it seems that the company behind

the courses seems to want to use this site.[/color]
[/quote]


Well, that is extremely unfortunate for the students. :eek:

I would suggest that they strongly complain about

this moronic intransigence. :rolleyes:

[/indent]
Copy linkTweet thisAlerts:
@net777authorFeb 20.2016 — This is taken from W3schools:

[CODE]
<script>
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
[/CODE]


This looks alot like Javascript so what parts are Javascript and what are HTML5?
Copy linkTweet thisAlerts:
@cootheadFeb 20.2016 — Hi there net777,

[indent]

This part...
[color=navy]
&lt;script&gt;

&lt;/script&gt;[/color]

..is HTML and this part...
[color=navy]
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"&lt;br&gt;Longitude: " + position.coords.longitude;
}[/color]

...is JavaScript.

It is best practise to put the JavaScript into an external file,

and let's say it's been named [i]"geolocation.js"[/i].

The HTML will then become...
[color=navy]
&lt;script src="geolocation.js"&gt;&lt;/script&gt;[/color]

[/indent]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@bokerFeb 20.2016 — Hi there net777,

[indent]

and a warm welcome to these forums. ?

If [color=navy][i]"PluralSight"[/i][/color] advocate the [color=navy][i]"innerText"[/i][/color] object, look elsewhere for tuition.

The [color=navy][i]"innerText"[/i][/color] object was introduced by Microsoft and is not a W3C standard.

It's implementation varies across browsers, and some may render it.

Importantly though, the Firefox browser does not support [color=navy][i]"innerText"[/i][/color] at all.


No, [color=navy][i]"Javascript"[/i][/color] is [color=navy][i]"Javascript"[/i][/color] and [color=navy][i]"HTML"[/i][/color] is [color=navy][i]"HTML"[/i][/color].

The former may be used to manipulate the latter. ?

As for [color=navy][i]"Javascript"[/i][/color] tuition, try this site...

[indent][url=http://javascriptexample.net/]JavaScript By Example[/url][/indent]

The author - ( [b]felgall[/b] ) - is well known contributor at many coding forums.

[/indent]

[i]coothead[/i][/QUOTE]


Thanks [B]coothead[/B] for [url=http://javascriptexample.net/]JavaScript By Example[/url]

i am newbie here..
Copy linkTweet thisAlerts:
@net777authorFeb 21.2016 — Ok, I think when some of the authors at the other site talks about HTML5, they also include native Javascript and CSS.

That makes more sense.
×

Success!

Help @net777 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.13,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...