Write a function to print out an HTML tag. The function should accept a mandatory argument of the image URL and optional arguments for alt text, height, and width.

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter3: Performing Calculations With Formulas And Functions
Section: Chapter Questions
Problem 4.7CP
icon
Related questions
Question
Write a function to print out an HTML <img> tag. The function should accept a
mandatory argument of the image URL and optional arguments for alt text, height,
and width.
Modify the function in the previous exercise so that the filename only is passed to
the function in the URL argument. Inside the function, prepend a global variable to
the filename to make the full URL. For example, if you pass 'photo.png' to the
function, and the global variable contains /images/, then the src attribute of the
printed <img> tag would be /images/photo.png'. A function like this is an easy way
to keep your image tags correct, even if the images move to a new path or a new
for example, from /images/ to
server. Just change the global variable
'http://images.example.com/'
-
Transcribed Image Text:Write a function to print out an HTML <img> tag. The function should accept a mandatory argument of the image URL and optional arguments for alt text, height, and width. Modify the function in the previous exercise so that the filename only is passed to the function in the URL argument. Inside the function, prepend a global variable to the filename to make the full URL. For example, if you pass 'photo.png' to the function, and the global variable contains /images/, then the src attribute of the printed <img> tag would be /images/photo.png'. A function like this is an easy way to keep your image tags correct, even if the images move to a new path or a new for example, from /images/ to server. Just change the global variable 'http://images.example.com/' -
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Image Element
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,