index.html or another name
Title
Question
You said we have name the html file as index.html
But in assignment you asked us to name ht as wedpage.html then how it render by default index.html or manually webpage.html
JavaScript How-to--use-JS-in-HTML 03-04 min 40-50 sec
Answers:
// assignment.js
console.log("A");
console.log("B");
<!DOCTYPE html>
<html>
<head>
<title>My JavaScript Assignment</title>
</head>
<body>
<h1>Check the Console!</h1>
<!-- Linking JavaScript file -->
<script src="assignment.js"></script>
</body>
</html>
CSS
A
B
<span data-huuid="1153926414128598914" style="color: rgb(0, 29, 53); font-family: "Google Sans", Arial, sans-serif; font-size: 18px;"> <code class="mv6bHd" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(229, 237, 255); border-radius: 4px; font-family: monospace; padding-top: 0px; padding-bottom: 0px;">index.html</code> offers the convenience of default loading on a web server, other filenames like <code class="mv6bHd" style="background: none 0% 0% / auto repeat scroll padding-box border-box rgb(229, 237, 255); border-radius: 4px; font-family: monospace; padding-top: 0px; padding-bottom: 0px;">webpage.html</code> require explicit referencing to be accessed. </span><span data-huuid="1153926414128597213" style="color: rgb(0, 29, 53); font-family: "Google Sans", Arial, sans-serif; font-size: 18px;">The choice of filename depends on whether the file is intended to be a default homepage or a specific page within a larger structure</span>
This example shows how to link an external JavaScript file to an HTML page. When the page loads, the JavaScript file runs and prints output in the browser console.
console.log("Hello JavaScript");
<span data-end="263" data-start="96"></span>
console.log("File linked successfully");
<!DOCTYPE html>
<html>
<head>
<title>JavaScript Linking Example</title>
</head>
<body>
<h1>Check the Console Output</h1>
<script src="assignment.js"></script>
</body>
</html>

Login to add comment