gardin wrote: ↑
Thu Jan 14, 2021 3:55 am
gardin wrote: ↑
Thu Jan 14, 2021 2:19 am
Code: Select all
//window.content.document.getElementsByClassName('dbm').innerHTML = "";
document.body.innerHTML += (html);
I posted these code already? Or should i put without <code> tag?
Oh...!, yep indeed, that's the one I meant, I had missed it indeed, "focusing" a bit on the 2 Screenshots that had not been uploaded to the Forum like I had asked, and you had 2 Screenshots, so I expected 2 Scripts...
OK, I only keep your formatted Script in my Quote, but keep indeed the non-formatted "Version" in your own Post, the "var html" Declaration is "so long", that it is indeed not very easy to read from the one-Line in the formatted Script, and it's easier to read from your Post...
So OK, "now" I understand where your "a" is coming from in the (final) "alert(a)" in your Script.
So this is the Script you were saying:
No luck in getting the variable to be used "outside". It keeps saying variable is not defined, or illegal syntax (see i am trying to alert "a" variable outside)
... And the Runtime Error (that I have to retype) from your Screenshot is:
Code: Select all
ReferenceError: a is not defined, line 7 (Error code: -991)
Then yep..., I'm not "too surprised", the "a" is only declared and known within the "Scope" of the "html" Var, and the JS Runtime Engine doesn't know anything (anymore) at the next Line in your Script...
So what you are missing is a Mechanism to pass the Content of that "a" Var to outside of the "html" Line for the rest of the Script to be able to access it and reuse it.
=> Still in the "html" Statement, see if you can pass it to the OS Clipboard in pure JS, or you would need to append some "fake" (invisible) 'DIV' to your Popup to re-extract at some next Line either using the 'EXTRACT' Mechanism in 'iim' or in pure JS, while the Popup is still "visible".
But I reckon the Popup will be Modal, so this won't work as the Popup will have already been dismissed when your Script will try to execute the next Line after the "html" Line, ah-ah...!
Then instead of appending that 'DIV' to the Popup, you will need to inject it directly in the "main" HTML of the "Parent" Page, (still from your "html" Line), where iMacros will then be able to re-extract it.
But this is "a bit" cumbersome, ah-ah...! But your Popup Declaration is already "a bit" cumbersome, ah-ah...! Now I understand what you were meaning with "rich Content", ah-ah...!
I still find like I had told you in your Original Thread on SOF that using the iMacros 'PROMPT' Command would be much easier, I would think..., as you probably don't really need all the "fancy" Formatting in your Popup...
I have an Enhancement Request btw in the following Thread
, => Item "5" about 'PROMPT' + 'ONPROMPT' to extend indeed a bit the whole Functionality of the 'PROMPT' Command. Feel "free" to support that EnhReq if you want, ah-ah...!
for example, from the Post I link to and beyond, other Advanced User @thecoder2012 is much more knowledgeable than me in pure JS, then in this Thread
also I think, and there should be another Thread on the Forum, from other Advanced User @iimfun, but I can seem to be able to locate it easily...
- (F)CI(M) = (Full) Config Info (Missing): iMacros + Browser + OS (+ all 3 Versions + 'Free'/'PE').
- I don't even read the Qt if that (required) Info is not mentioned...!
- Script & URL help a lot for more "educated" Help...