473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

am pasting a suggested code on Javascript but getting a response Undefined. kindly he

Expand|Select|Wrap|Line Numbers
  1. document.body.addEventListener('click', function () {
  2.      var myParent = document.getElementById("Banner"); 
  3.      var myImage = document.createElement("img");
  4.      myImage.src = 'https://thecatapi.com/api/images/get?format=src&type=gif';
  5.      myParent.appendChild(myImage);
  6.      myImage.style.marginLeft = "160px";
  7. });
Jan 3 '19 #1

✓ answered by gits

you would need to explain more what the exact problem is - basically i think the only thing that can go wrong here seems to be that you dont have an element with the id 'Banner' in your page - so that code cant find the element to append the image to.

2 1583
gits
5,390 Expert Mod 4TB
you would need to explain more what the exact problem is - basically i think the only thing that can go wrong here seems to be that you dont have an element with the id 'Banner' in your page - so that code cant find the element to append the image to.
Jan 4 '19 #2
Thank you but it turned out to be fine.Warm Regards.
Jan 6 '19 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Hal | last post by:
Can someone please tell me what is wrong with this script? <script language="JavaScript"> <!-- function HF_CloseAllChildren() { if (g_win1) != undefined { if ((g_win1) && !(g_win1.closed))...
3
by: Miles | last post by:
I have an ASP.Net text box which I am adding a javascript event (onChange) at runtime. It passes a parameter which is another control which I am getting the name for from the ClientID property. ...
2
by: Tina | last post by:
I'm trying to get started with Atlas and associated necessary javascript at the same time. I started out at http://atlas.asp.net/walkthroughs/gettingstarted/basic.net where they have an...
2
by: FrogBunz | last post by:
Is there a way to execute inline javascript code from within an AJAX response? I use AJAX to retrive a JSP page that is loaded using a database bean. One of the form elements is a select that I...
11
by: Sachin Garg | last post by:
I need to build two executables from my code, one having all the code (and thus application features) and other not having it all. How to best manage the code that shouldn't go in one of the...
2
by: sukatoa | last post by:
Good day, Im new to JavaScript and would like also to learn Ajax by having experiments and to apply directly to an application(Hope this could also be effective) Now, i will attempt to conduct...
3
by: vtpvp82 | last post by:
I am having problem in getting response from remote server for that I have written following script response got correctly but the data on the page is not displayed it gives “–“ in place of grid...
1
by: sree ram | last post by:
code for getting maximum rows in excel sheet using perl script
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.