<html>
<script language="javascript">
/* This function is invoked by the activity */
function wave() {
alert("1");
document.getElementById("droid").src="android_waving.png";
alert("2");
}
</script>
<body>
<!-- Calls into the javascript interface for the activity -->
<a onClick="window.demo.clickOnAndroid()"><div style="width:80px;
margin:0px auto;
padding:10px;
text-align:center;
border:2px solid #202020;" >
<img id="droid" src="android_normal.png"/><br>
Click me!
</div></a>
</body>
</html>
My question is: What is "window.demo.clickOnAndroid()"?
I know that clickOnAndroid is a method in my Android application. But what is window and demo? My file is called demo.html. Is that it?
window
is the javascript window object:
The window object represents an open window in a browser.
window.demo
means that a demo
object has been assigned as a property (or instance variable) of window
, so window.demo.clickOnAndroid()
means that you are invoking clickOnAndroid()
on the window
's demo
. Therefore demo
is the name of the instance of your Android application, your real application would be up to you to name, so your invocation would probably look like window.serious.clickOnAndroid()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With