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);

Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

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.

How to Retrieve full Profile of LinkedIn User using Javascript

I am trying to retrieve the full profile (especially job history and educational qualifications) of a linkedin user via the Javascript (Fetch LinkedIn Data Using JavaScript)

How to Create an Animated Navbar with Html, CSS and JavaScript

In this Html, CSS and JavaScript tutorial you will build an animated navbar with Html, CSS and JavaScript. Have you every wanted to create an awesome animated navbar with JavaScript? We will be looking at making a navbar with Html and CSS and then using the intersection observer in JavaScript to help us create this effect.