Sunday, March 4, 2012

Custom Widget -> Create HTML Element

Hi,

i like to create a Custom widget with javascript, but did not find a
tutorial for this. I tried to create a simple "div" Elment for the
start. But this does not work. Throws some errors. Can someone tell me
some good tutorial on this or give me some tips to correct my code?

package test.client;

import com.google.gwt.user.client.ui.Widget;

public class CustomWidget extends Widget{


public CustomWidget(){
super();
createElement("sdf");

}

public static native void createElement(String msg) /*-{

var newdiv = $doc.createElement('div');
newdiv.setAttribute('id','testid');

newdiv.innerHTML = 'Test Element';
$doc.appendChild(newdiv);
}-*/;

}


Thanks very much
jan

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment