Is it "code" or "markup"?
Is this:
<h1 id="superheader">Morbi in sem quis</h1>
<ul class="highlight">
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li class="important">Vestibulum auctor dapibus neque.</li>
</ul>
<p id="fancy"><a href="#" onclick="javascript:theFunc();">Vestibulum tortor quam</a>. Pell开发者_开发技巧entesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Feugiat vitae, ultricies eget, tempor sit amet, ante. </p>
<script type="text/javascript">
// do some things
alert("hi!");
</script>
"code" or "markup", or even something else entirely, and why?
The context is that we are writing instructions for users who range from slightly to very technical, and need to agree on a term for the template document.
All of the HTML tags are "markup", although the JavaScript that they contain is "code".
You have both.
The line alert("hi!");
in script tags and the onclick handler javascript:theFunc();
is program code. The rest is standard HTML markup.
That's both. HTML is a markup language. JavaScript is a programming language, so those portions of your document are code.
Markup is the most correct answer. It is, after all, the Hypertext Markup Language.
"Code" can apply equally to markup like HTML and to a programming language. To clarify that the essence of HTML is not programming in any way, "markup" is a better choice.
Any markup is a kind of code (a strict code that represents some desirable output). But the pieces of JS are not markup. Therefore I'd say this is a piece of code, where some parts are also markup.
I think it is code, in a description language, not a programming language, but still code.
If you must pick one word, I would go with code.
From wikipedia: A code is a rule for converting a piece of information (for example, a letter, word, phrase, or gesture) into another form or representation (one sign into another sign), not necessarily of the same type.
Calling html "html code" is not at all uncommon while calling something javascript markup is pretty rare.
In this case, both Markup and Code are present. Markup includes the lines of HTML and code includes the javascript. However, if you clearly understand, all these javascript codes will be packed within html tags. We can mention the entire code as markup language.
精彩评论