Q:
In a desktop application, I have a web view section and a canvas section.
How can I reference an id in the webview section from the canvas section?
A:
The WebView section has an evaluate() method which lets you execute JavaScript inside it.
evaluate() document.getElementById('name').value;
Q:
access to the webview objects from outside the webview.
Meaning - If I want to change the innerhtml of an item in the webview from a canvas section how can that be accomplished.
I guess another way to ask the same question is what is the hierarchy of webview in the LOM/DOM
something like Lianja.page1.document.getElementById("Title").inne rHTML = "New Title!";
A:
reference to the WebView section in Lianja.
Code:
myview = Lianja.getElementByID("page1.section1").webview
If you define a JavaScript function in your WebView HTML using a <script> tag. It can take an ID and the innerhtml that you want to replace.
You can then call the evaluate() function to execute your JavaScript function.
Code:
myview.evaluate("updateHtml('someid', 'newhtml')")
Both your onclick and your evaluate need to be enclosed in quotes and you call evaluate() in the WebView not the Lianja system object.
Code:
Mycall.evaluate("sayhi()")
Code:
mycall = Lianja.getElementByID("page1.section1").webview
myview.evaluate("sayhi()")
you can call functions in the WebView using oWebView.evaluate() and those functions can use Lianja.evaluate() inside the WebView function to call other functions in the App. It's a two way interaction.
And with a little thought one WebView can call functions in another WebView which may be on a different page.
All topics in [Answers] alphabetically:http://www.lianja.com/community/showthread.php?2717-Answers
Bookmarks