Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Getting image src when is loaded using setTimout
Forum Updated to NodeBB v4.3 + New Features

Getting image src when is loaded using setTimout

Scheduled Pinned Locked Moved Qt WebKit
2 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • 2 Offline
    2 Offline
    2beers
    wrote on last edited by
    #1

    hi everyone. So let's say I have the following html code:

    @<html>
    <head></head>
    function changePic(){
    document.getElementById("somePic").src="http://qt.nokia.com/images/template/icon-qt-in-a-box";
    }
    <body onload="setTimeout('changePic();',1000);">

        some text<br></br>
        
        &lt;img id="somePic" title="about the pic" src=""&gt;&lt;/img&gt;        
    &lt;/body&gt;
    

    </html>@

    I'm interested in getting the image source (src attribute). When the loadFinished is emited the src attribute is "" because the image will be loaded only after 1 second after the page is loaded.

    Is there a way to solve this?

    1 Reply Last reply
    0
    • W Offline
      W Offline
      webpoker
      wrote on last edited by
      #2

      add an listener on image.so
      @
      <html>
      <head></head>
      function changePic(){
      document.getElementById("somePic").src="http://qt.nokia.com/images/template/icon-qt-in-a-box";
      }
      function showSrc(img){
      alert(img.src);
      }
      <body>

          some text<br></br>
           
         &lt;img id="somePic" title="about the pic" src="" onload="showSrc(this&#41;"&gt;&lt;/img&gt;        
      &lt;/body&gt;
      

      </html>

      @

      canon in lief

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved