Calling a JS function from HTML IFRAME (both web resources)

VikaReni

New Member
I've uploaded two web resources, a.HTML and b.JS. In the HTML document I have a section where a script is executed (and it works as supposed to) upload loading into the IFRAME on my form.Now, because of the size of the code, I feel the need to refactor it and I'd like to move out some of the methods from the script tag of my HTML web resource to a separate JS web resource.At the first step I've set up the separate JS web resource as follows.\[code\]function test() { alert("Success."); }\[/code\]From the script inside the HTML document I execute the following, getting an error as test seems not to be known to the page.\[code\]alert("Get ready for test...");test();alert("Did it work?");\[/code\]I've added the JS web resource to the form and savepublished, of course. There's surprisingly little info on the subject out there. I've found those links but none of them matches exactly what I need and gives me no hint on how to approach the issue at hand.
  • This link resembles what I want to achieve but it's about calling JS from JS where both are web resources.
  • This link is diagonally opposite to what I want but I don't know how to reverse it from calling HTML from JS whre both are web resources.
What should I correct?
 
Back
Top