Change HTML img src=""

Discussions and Tech Support related to the iMacros Firefox Add-on, including the built-in Javascript scripting interface for playing .js files.
Forum rules
Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information:CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
CherylAN
Posts: 1
Joined: Tue Mar 27, 2018 1:24 pm

Change HTML img src=""

Post by CherylAN » Tue Mar 27, 2018 1:40 pm

Code: Select all

<span id="outerd3">

<img src="img1">

<img src="img2">

<img src="img3">

</span>
into this

Code: Select all

<span id="outerd3">

<img src="img1">

<img src="img1">

<img src="img1">

</span>
replace img1 to all

this is possible with Imacros??
chivracq
Posts: 8201
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change HTML img src=""

Post by chivracq » Tue Mar 27, 2018 9:32 pm

CherylAN wrote:

Code: Select all

<span id="outerd3">

<img src="img1">

<img src="img2">

<img src="img3">

</span>
into this

Code: Select all

<span id="outerd3">

<img src="img1">

<img src="img1">

<img src="img1">

</span>
replace img1 to all

this is possible with Imacros??
No need to open Duplicates when you want to post on the Forum...
And try to post in the correct Sub-Forum, this Thread has nothing specific to FF, especially if you don't even mention your FCI (read my Sig...), but no need to open another Duplicate now...

"Securing" this low Quality Thread in case its parallel Thread on SOF gets some Solution...
(Some Answer posted in 'php' I think for the moment, not really related to iMacros I would think...)
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
chivracq
Posts: 8201
Joined: Sat Apr 13, 2013 1:07 pm
Location: Amsterdam (NL)

Re: Change HTML img src=""

Post by chivracq » Wed Mar 28, 2018 8:12 pm

Hum, no Follow-up on this Thread from @OP while they checked the Thread/Forum, FCI not mentioned... But OK, I'm not "too surprised" actually from the "original" Low Quality...

Mini-interesting Development is that Advanced User @Shugar posted a Solution (for iMacros, ah-ah...!) on SOF:
And here is a solution for 'iMacros':

Code: Select all

URL GOTO=javascript:(function(){var<SP>img=document.querySelector("#outerd3").querySelectorAll("img");for(i=0;i<img.length;i++)img[i].src="avatar.jpg";})();
No Follow-up on SOF either, I'm kind of waiting for some "Euh..., it doesn't work...!", => yep, normal, FCI not mentioned, I guess this Syntax won't work in v9.0.3 for FF, and only in v8.9.7 for FF...

I (still) don't really understand the Use for such a Need, to be honest..., if you care to explain a bit, @OP...? :?

OK, the Source of the Page will be altered, but not the Display of the Page I would think, and some 'Refresh'/'Reload' of the Page would bring back the original Content from the Web-Server I would think... iMacros will apply any Changes after the Page has actually (finished) loaded/loading, not like GreaseMonkey/ABP/ABE which are able to intervene before/while the Page gets loaded/is being loaded...
If the Script goes further with some "Actions" expecting all those 'img/src' Attributes to be the same, yeah..., why not..., but I find that a bit "useless", if the 'func' was able to find and modify them, then there are other ways to do the same for further Processing with an iMacros Script in more "Standard" iMacros Coding/Techniques... :?

The "Purpose" of this Syntax (which is more of an "Advanced" Trick actually) is "normally" to make some invisible/disabled (Input) Field editable on the fly for the same Script further down to be able to fill it in, I've seen it being used as well to modify on the fly some Zoom Value for example (even if the Display doesn't/cannot take it into account), but I don't really see the Use in this Case... :?
- (F)CIM = (Full) Config Info Missing: iMacros + Browser + OS with all 3 Versions...
- I usually don't even read the Question if that (required) Info is not mentioned...
- Script & URL usually help a lot for a more "educated" Help...
Post Reply