answersLogoWhite

0


Best Answer

To add javascript code in HTML, you have to include the script tag on top. It can be added as <script src="source of script"></script>

User Avatar

Wiki User

9y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What element do you use to add JavaScript code to a web page and how is it structured?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why browser having only HTML code?

HTML is the standard for defining web page element and is supported by all browsers. but webpages have also JavaScript and cs code as well.


How do you write a javascript?

go to notepad and write Javascript code and save it as .js and then import it into a page with a src tag


Which are the new element of HTML5 that lets scripting applications dynamicaly render graphics animations or other visual images?

is a new HTML5 element that allows scripts (usually JavaScript) to draw graphics on the fly. The container holds the JavaScript code that does the actual drawing.


How do you put java script into HTML?

Javascript inside html &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" language="javascript"&gt; // Java script code here &lt;/script&gt; &lt;body&gt; // html code here &lt;/body&gt; &lt;/html&gt; Via External Link: &lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" language="javascript" src="location of js file"&gt; &lt;/script&gt; &lt;body&gt; // html code here &lt;/body&gt; &lt;/html&gt;


What is embedding java script?

To embed JavaScript code is to include it in the HTML page. For example, this will embed the code to display an alert: &lt;script type="text/javascript"&gt; alert("Embedded alert!"); &lt;/script&gt;


What is the Javascript onclick?

Onclick will be called when the object you're attaching the onclick function to is clicked (usually the object is an HTML element).


Is JavaScript code executed when the page is loaded or when instructed to by the web code?

That depends. If you just put some javascript code somewhere (like document.write('hello')) it will be executed on page load. However, you'll mostly want to use functions; you then call those functions on certain events (like a button onclick) to execute their code.


What language is Facebook written in?

xhtml and javascript mostly...probably with extra code for specific functions. to find out a web page's source code right-click page and select "view page source"


How is the main content area of a page described in HTML code?

The main content of the page is wrapped with BODYtags:... meta data, title, javascript, etc. ...... main content and more HTML code ...


What is the command to display HTML page through javascript?

If you're planning on linking to another page, all you have to write is: document.location = "yourNewURL"; If you want to generate Javascript, then you can either use: document.write("your HTML Code"); OR send the HTML code to an existing object in an HTML page, like so: document.getElementById['targetElement'].innerHTML = "your HTML Code here"; ----------------- That's pretty much it. If you want me to elaborate, please let me know. :)


How does javascript work?

JavaScript is what is called a Client-side Scripting Language. That means that it is a computer programming language that runs inside an Internet browser (a browser is also known as a Web client because it connects to a Web server to download pages). Inside a normal web page you place a JavaScript code inside. When the browser loads the page, the browser has a built-in interpreter that reads the JavaScript code it finds in the page and runs it. Web page designers use JavaScript in many different ways. One of the most common is to do field validation in a form. Many websites gather information from users in online forms, and JavaScript can help validate entries. For example, the programmer might validate that a person's age entered into a form falls between 1 and 120.


What is HEAD in JavaScript?

'head' is an element in HTML that is accessible to web browser implemented JavaScript via the DOM or Document Object Model. The head element works as a container for information that is not intended to show on the page itself. The web-page title, referens to css-files or js-files would normally be placed within the head tag, along with SEO metadata. The head-tag is required for a web page to be semantically valid.