diff -r d545c801b86a gluon/compileapp.py
--- a/gluon/compileapp.py	Thu Mar 01 09:12:19 2012 -0600
+++ b/gluon/compileapp.py	Thu Mar 01 14:34:27 2012 -0300
@@ -122,6 +122,9 @@
     is added on page loading without delay.
     """
     from html import TAG, DIV, URL, SCRIPT, XML
+    create_div = True
+    if target is not None:
+        create_div = False
     if args is None: args = []
     vars = Storage(vars or {})
     target = target or 'c'+str(random.random())[2:]
@@ -154,7 +157,10 @@
         else:
             statement = "web2py_component('%s','%s');" % (url, target)
         script = SCRIPT(statement, _type="text/javascript")
-        return TAG[''](script, DIV(content,**attr))
+        if create_div:
+            return TAG[''](script, DIV(content,**attr))
+        else:
+            return TAG[''](script)
 
     else:
         if not isinstance(args,(list,tuple)):
