inline Javascript

I have inline javascript at the bottom of HTML that is supplied to the WE framework in a WebControlWrapper setupHTML event. (in tags)

I’m accustomed to the JS executing and, while it appears in the DOM, it doesn’t execute.

Is there a way to have it execute “normally”?

When (which event) are you trying to execute it and how?

I want it to execute inline. Script tags placed within the HTML will execute as they are added to the DOM.

except in Xojo for some reason

[quote=215157:@Steve Upton]I want it to execute inline. Script tags placed within the HTML will execute as they are added to the DOM.

except in Xojo for some reason[/quote]
Actually… Script tags run when they’re part of the html when its first delivered to the browser. That’s not the case here. The html sent through the SetupHTML event is inserted later, and browsers don’t just run that code. My suggestion is to wrap it in a function declaration and call it.

well… don’t mean to argue, as I think we’re talking about different things.

The HTML/javascript fragments I’m referring to are currently working through a “normal” AJAX mechanism. It’s not an entire page but rather just HTML divs with a trailing section.

So, considering that it works via AJAX, I’m wondering why it doesn’t work via Xojo…

I don’t think you’re arguing. :slight_smile:

It depends a lot on what your “normal Ajax” code does after it receives the new code. All I’m saying is that’s what you’ll have to do with our framework.

This is one of those places where we had to do some magic to get consistent behavior on all supported browsers. As I recall, one of the early supported IE versions had issues with inserting tags at runtime.

fair enough… The surprising thing to me was that I could see the script tag in the DOM yet it wasn’t getting executed.

As a test I put a small function definition into the script tag and tried to call it from ExecuteJavaScript, yet it didn’t “exist”.

It’s not a big deal, it’s a situation where we’d like to use parts of an existing system that executes this code and the less refactoring the better.

The existing system uses Prototype.js and just inserts the ajax-returned text into a DIV. The javascript gets executed along the way.

Xojo is somewhat more dynamic i’d make a js function off it and call it in the shown event.

I hope that can help you