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

    Question How to add the reference to the picture?

    Hello, i try to understand greasemonkey.
    I choose the random page, for example: http://www.3dnews.ru/914550.
    And I change the picture.
    Java Code:
    var sear = /http:\/\/www.3dnews.ru\/assets\/external\/illustrations\/2015\/05\/23\/914550\/sm.hhop-2.600.png/gi;
    var chang = 'http://img0.joyreactor.cc/pics/comment/anon-1790683.jpeg';
    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="http://www.3dnews.ru/assets/external/illustrations/2015/05/23/914550/sm.hhop-2.600.png" alt="" height="338" width="558" />
    I try to change it to:
    XML Code:
    <a href="https://traktor.d3.ru/"><img src="http://img0.joyreactor.cc/pics/comment/anon-1790683.jpeg" alt="" height="338" width="558" /></a>
    And make it:
    Java Code:
    var sear = /<img src="http:\/\/www.3dnews.ru\/assets\/external\/illustrations\/2015\/05\/23\/914550\/sm.hhop-2.600.png" alt="" height="338" width="558" \/>/gi;
    var chang = '<a href="https://traktor.d3.ru/"><img src="http://img0.joyreactor.cc/pics/comment/anon-1790683.jpeg" 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
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    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.

    Regards,
    Jim
    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
    Location
    Madgaon, Goa, India
    Posts
    12,059
    Rep Power
    25

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

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

    db
    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
  •