Skip to Content
avatar image
Former Member

WebWidget in Webdynpro Java Does not work.

Hi experts,

I try to embed my javascript by using WebWidget. If I put my piece of code in wdDoInit(), it works fine. But If I call this in an event ( when a buttom is triggered), then nothing shows up.

StringBuffer buffer = new StringBuffer(); 
buffer.append("<div id=\"panel\"></div>"); 
buffer.append("<script>"); 
buffer.append("var str = \"Hello Test.\";"); 
buffer.append("genode(str, \'panel\');"); 
buffer.append("function genode(str, id) {"); 
buffer.append("alert(str);");
buffer.append("}"); 
buffer.append("</script>"); 
wdContext.currentContextElement().setExportHTMLString(buffer.toString());

If I simply put the following code in my event, Javascript can be called successfully.

StringBuffer buffer = new StringBuffer();  
buffer.append("<input type=button onclick='JavaScript:window.print()' name='b1' value='print>");
wdContext.currentContextElement().setExportHTMLString(buffer.toString());

Somehow I find out that the system does not buy

buffer.append("<script>"); 

OR

buffer.append("<script type = \"text/javascript\">")

Please kindly guide me the correct direction.

thanks,

zita

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers