dynamic value pass to applet based on dropdown value selection
I have to pass value dynamically to applet so that it can pick correct xml from resource based on the value selected from the dropdown .
<applet code="com.vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500" >
</applet>
How can i do开发者_运维问答 that .
You can handle this by writing a public method in your applet let's assume
void setXmlName(String xmlName);
you can access this method from java script .. for example this java script method
function updateXmlName(value){
/* Get an object of the applet .. make sure the at 'id' attribute has the 'myappletid' value. */
var myApplet = documents.applets["myappletid"];
myApplet.setXmlName(value);
}
update your dropbox HTML
<select id="optionList" onchange="updateXmlName(document.getElementById('optionList').value);>
I hope this could help you.
If you choose a value from dropdown and then send it to the page with applet then used simple <param>
tag (as described here). If you want to do it dynamically, then you can invoke java methods via javascript as described here.
精彩评论