Questions tagged [src]

SRC is a common attribute in HTML used to identify the location of a resource which relates to an element.

Within HTML, several elements may make use of the src attribute in order to identify a resource to which the element may relate. It is normally a "valid non-empty URL potentially surrounded by spaces".

Questions often arise relating to the attribute due to confusion between absolute and relative URLs, how src URLs relate to the location of files, and browser caching.

Some examples of elements which use the src attribute are:

  • IMG

    Specifies a URL referencing a non-interactive, optionally animated, image that is neither paged nor scripted.

  • IFRAME

    Gives the address of a page that the nested browsing context is to contain.

  • SCRIPT

    Gives the address of the external script resource to use.

  • EMBED

    Gives the address of the resource being embedded.

  • VIDEO

    The URL for the video.

  • AUDIO

    The URL for the audio stream.

  • TRACK

    Gives the address of the timed track data. This attribute must be present.

There are other elements which may make use of the src attribute, which may be discovered at the W3C Community Wiki.

Related tags: , , , ,

1799 questions
0
votes
1 answer

How to keep single HTML5 attributes under 80 characters?

I'm designing a web page and would like to keep all lines under 80 characters long, how is this accomplished with rather long URLs and still have them validate?
Snaitf
  • 1
0
votes
2 answers

Making sure the src attribute has http:

I am using this jquery script to import parts of wikipedia articles, but I have run into an issue where when this script is putting together an image tag, it strips out "http:" (or rather, it was't there in the first place?) from the src attribute.…
user2219915
  • 289
  • 3
  • 7
  • 19
0
votes
2 answers

jQuery: addClass to elements with same or matched source

I have an array in my js file that loads images into html for a slideshow and for thumbnail navigation. The slideshow img src matches one of the thumbnail image src attributes every 4 seconds. This timing is based off of a setInterval. I would like…
Designaroni
  • 112
  • 1
  • 10
0
votes
1 answer

fetch value of file upload from meta-box plugin ?

I have meta-box plugin and I added file upload array( 'name' => __( 'Image or Video Upload', 'rwmb' ), 'id' => "{$prefix}upload", 'type' => 'file_advanced', 'max_file_uploads' => 1, 'mime_type' => 'image,video', ), and I…
JayDeep Nimavat
  • 476
  • 6
  • 22
0
votes
1 answer

Showing in a site images belonging to other domain using php

I have two domains sharing the same server. One of them, site_1.com, holding images at directory /images and the other one site, site_2.com, must to show those images. I have the following code at site_2:
héctor
  • 3
  • 3
0
votes
1 answer

Why won't my image show in my HTML file despite the correct location?

This is my FTP files: [folder] resources -> [png] header.png -> [png] leftpanel.png -> [png] button_prd.png -> [png] button_hp.png [jpg] header.jpg [png] header.png [html] index.html [html] aboutus.html [png] button_prd.png [html]…
AllKeggedOut
  • 13
  • 2
  • 5
0
votes
1 answer

Change image source on click from another image [JQuery]

I have a carousel menu, see the screenshot below: When I click on "Macchine" the
containing a big image appears (in the example the big green image with the number 1). Besides a table with thumbnails is generated automatically below in…
Fabio
  • 2,074
  • 2
  • 24
  • 38
0
votes
2 answers

Why doesn't this get an image's native dimensions?

I'm working on a lightbox, and I need to get the native dimensions of an image element to be displayed. I'm working on a method based off this tutorial by CSS-Tricks. My picture is 400x400 pixels natively, but my method keeps returning 0x0. Here's…
Ber
  • 695
  • 1
  • 11
  • 17
0
votes
1 answer

Using mysql to replace img src? NEWBIE

I tried to use the Enable Media Replace ( http://wordpress.org/plugins/enable-media-replace/ ) to replace some images on my site with updated versions. There is an option to update all instances where the file is used on the site, but this only…
Tish W.
  • 1
  • 1
0
votes
1 answer

Changing img src folder from javascript imagemap

I've made an imagemap with 9 areas, using mapster. Clicking an area now results in displaying some text above the imagemap. I would like to display images from several folders instead, depending on the area that is selected. When area 'kamer1' is…
Laureus
  • 3
  • 3
0
votes
1 answer

Access File in bin folder of Java web application

I want to read a text file from src folder of class activitydata. In order to do that, I wrote following code ActivityData c = new ActivityData(); Class cls = c.getClass(); URL url =…
NNN
  • 87
  • 1
  • 2
  • 7
0
votes
3 answers

jQuery - Replace main image source with dynamic image source

I have a list of images showing and each image got a list of 1 or more additional thumbnail images. When use hovers on one of the additonal images, the main image has to change with that addional image's source, and when mouse leaves that thumbnail,…
mlclm
  • 725
  • 6
  • 16
  • 38
0
votes
4 answers

getElementById() is null?

So I am trying to make a JavaScript program that will take a URL for an image and then put it onto the page while creating an tag so that I can just continue pasting as many photos as I want. Here's the code:
0
votes
1 answer

Set the src attribute of img tag from an array element

I have an array pics = ["url1", "url2", "url3"] I want want to be able to set the src attribute of an image to an array element like so: Problem is that html does not recognize that I am want the string element pic[0] not…
user1452494
  • 1,145
  • 5
  • 18
  • 40
0
votes
1 answer

How to source an image from your own folder

New to HTML coding I have a folder containing a) my HTML file for my homepage b) a folder called images In my image tag if I copy and paste the whole url from my c drive C:..... then the image works. I want to use a…
1 2 3
99
100