admin管理员组文章数量:1396837
I want to change the param value of the applet tag based on the value from the dropdown. I am new to jquery .can someone tell me how can i do it using jquery .
My applet code :
<applet id="decisiontree" code=".vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500" >
<param name="dieasenmae" value="Malaria"/>
</applet>
My dropdownc code :
<html:select name="AuthoringForm" property="disease_name" size="1" onchange="javascript:showSelected(this.value)">
<option>Malaria</option>
<option>High Fever</option>
<option>Cholera</option>
</html:select></p>
javascript:
function showSelected(value){
alert("the value given from dropdown is "+value);
$("#decisiontree param[name='dieasenmae']").val(value);
}
I want to change the param value of the applet tag based on the value from the dropdown. I am new to jquery .can someone tell me how can i do it using jquery .
My applet code :
<applet id="decisiontree" code=".vaannila.utility.dynamicTreeApplet.class" archive="./appletjars/dynamictree.jar, ./appletjars/prefuse.jar" width ="1000" height="500" >
<param name="dieasenmae" value="Malaria"/>
</applet>
My dropdownc code :
<html:select name="AuthoringForm" property="disease_name" size="1" onchange="javascript:showSelected(this.value)">
<option>Malaria</option>
<option>High Fever</option>
<option>Cholera</option>
</html:select></p>
javascript:
function showSelected(value){
alert("the value given from dropdown is "+value);
$("#decisiontree param[name='dieasenmae']").val(value);
}
Share
Improve this question
edited Aug 29, 2011 at 11:34
bhalkian
asked Aug 29, 2011 at 11:24
bhalkianbhalkian
4995 gold badges15 silver badges32 bronze badges
1
- 1 I'm not sure that the Java plug-in will accept these changes. That would mean to monitor the DOM tree and abort current applet's execution when changes are detected and it doesn't seem sensible. – Álvaro González Commented Aug 29, 2011 at 11:29
3 Answers
Reset to default 3just use:
var myNewValue = 'my new value';
$("#decisiontree param[name='dieasenmae']").val( myNewValue );
Live example on JSBin.
Selector explanation:
$("#decisiontree param[name='dieasenmae']")
^ ^ ^ ^
1 2 3 4
- 1 -> inside the ID
decisiontree
- 2 -> find all elements of the type
param
- 3 -> that has the attribute
name
- 4 -> and that attribute value needs to be
dieasenmae
Now that you know how to change the values, that does not mean it will work! as you need to understand and see how the <applet>
will work, as normally, it loads all values on start, and no matter what you do after in the DOM, the Applet can just ignore it... there should have a refresh applet
somewhere, for that, the easiest way is to follow up to this question:
Is there a way to reload/refresh a java applet from within the applet itself?
$('param').attr('value','your-value');
or
$('param').val('your-value');
Make sure to launch it when dom is ready or use document.ready
$(document).ready(function()
{
$("#decisiontree param").val("newValue");
// or
$("#decisiontree param").attr("value","newValue");
});
本文标签: javascripthow to change the value in the html tag using jqueryStack Overflow
版权声明:本文标题:javascript - how to change the value in the html tag using jquery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744144509a2592771.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论