Grabbing local hostname and creating link with images Javascript

Grabbing local hostname and creating link with images Javascript

I am trying to create an image link based on the location of the server it is hosted on. If the server is server1. I want the image to be linked to&nbsp;<a href="http://server1/dod" target="_blank" style="color: rgb(0, 89, 153);">http://server1/dod</a>" I'm trying to get two images with this shot. However, nothing is loading. I am missing a piece and I don't know where. I'm also hosting this on an IIS server.

I am trying to create an image link based on the location of the server it is hosted on. If the server is server1. I want the image to be linked to http://server1/dod" I'm trying to get two images with this shot. However, nothing is loading. I am missing a piece and I don't know where. I'm also hosting this on an IIS server.

<!DOCTYPE html>
<html>
     <body>
          <div>
             <p id="Images"></p>
          </div>

      &lt;script&gt;
           var local = location.hostname;

//SP Edit, save a reference to the images node var Images = document.getElementById("Images");

           var dodlink = document.createElement(a);
           dodlink.href = "http://" + local + "/DoD/";

           var dodimg = document.createElement("img");

//SP Edit dodimg.src ="DOD.png"; //SP Edit dodimg.width = 256; //SP Edit dodimg.height = 256; dodimg.setAttribute("src", "DOD.png"); dodimg.setAttribute("width", "256px"); dodimg.setAttribute("height", "256px"); dodlink.appendChild(dodimg);

//SP Edit document.getElementByID("Images").innerHTML = dodimg; Images.appendChild(dodimg);

           var derlink = document.createElement(a);

//SP Edit derlink.href = "http://" + local + "/DER/"; deflink.setAttribute("href", "http://" + local + "/DER/");

           var derimg = document.createElement("img");

//SP Edit derimg.src ="DER.png"; //SP Edit derimg.width = 256; //SP Edit derimg.height = 256; derimg.setAttribute("src", "DER.png"); derimg.setAttribute("width", "256px"); derimg.setAttribute("height", "256px"); deflink.appendChild(derimg);

// Images.appendChild(deflink);

html javascript

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Know Everything About HTML With HTML Experts

HTML Assignment Help Australia @30% OFF from Sample Assignment, with Our Best HTML assignment help experts. Get HTML homework help online at affordable price. 100% Plag free assignment solution.

HTML JavaScript - Add Javascript File to HTML

Learn HTML and javascript, their uses & importance, html javascript function, javascript tags list, why add javascript file to html, HTML Events with JavaScript etc

Commonly Used HTML Tags with Examples

HTML tags are keywords used in HTML to display web-pages with certain properties. They are further used for defining HTML elements. An HTML element consists of a starting tag.

Countdown with HTML, CSS, and JavaScript / How to create JavaScript Countdown

Countdown with HTML, CSS, and JavaScript / How to create JavaScript Countdown. W will build a Responsive Website with HTML, CSS, and JavaScript

Render HTML with Vanilla JavaScript and lit-html

Sometimes you need to render HTML elements on a web page. And like Goldilocks' search for "just right", you have to try a few techniques before you find the right one. Using a framework may be too hard. Using pure HTML and the DOM API may be too soft. What you need is something in the middle that is just right. Is lit-html "just right"? Let's find out.