Results 1 to 3 of 3
  1. #1
    toster is offline Member
    Join Date
    May 2015
    Rep Power

    Question How to add the reference to the picture?

    Hello, i try to understand greasemonkey.
    I choose the random page, for example:
    And I change the picture.
    Java Code:
    var sear = /http:\/\/\/assets\/external\/illustrations\/2015\/05\/23\/914550\/sm.hhop-2.600.png/gi;
    var chang = '';
    document.body.innerHTML = document.body.innerHTML.replace(sear,chang);
    It works.
    Now I look for the reference to the picture in an initial code.
    Here it:
    XML Code:
    <img src="" alt="" height="338" width="558" />
    I try to change it to:
    XML Code:
    <a href=""><img src="" alt="" height="338" width="558" /></a>
    And make it:
    Java Code:
    var sear = /<img src="http:\/\/\/assets\/external\/illustrations\/2015\/05\/23\/914550\/sm.hhop-2.600.png" alt="" height="338" width="558" \/>/gi;
    var chang = '<a href=""><img src="" alt="" height="338" width="558" /></a>';
    document.body.innerHTML = document.body.innerHTML.replace(sear,chang);
    It doesn't work. Even the picture doesn't change.
    You can tell me why it doesn't work?

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Northern Virginia, United States
    Rep Power

    Default Re: How to add the reference to the picture?

    This is a Java forum, not a JavaScript forum. Perhaps you should use some print statements to see how the URL's appear.

    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Madgaon, Goa, India
    Rep Power

    Default Re: How to add the reference to the picture?

    Not a Java question. Moved from New to Java to Forum Lobby.

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Replies: 3
    Last Post: 07-24-2013, 05:03 PM
  2. Replies: 0
    Last Post: 07-17-2013, 08:04 AM
  3. Replies: 1
    Last Post: 05-24-2012, 04:44 PM
  4. Getting a picture out of a jar?
    By Zman3359 in forum New To Java
    Replies: 4
    Last Post: 02-02-2011, 11:55 PM
  5. Picture help
    By deathnote11 in forum AWT / Swing
    Replies: 13
    Last Post: 06-03-2008, 05:46 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts