How to add some javascript in a form using form API? I need to output some javascript codes as well as form fields.

I am using Drupal 6 and form API to build the form. How can I output those javascript codes? Is there a 'javascript' type like textfield/checkboxes ?

I have tried the code below but string 'Array' is printed on the page instead of js code:

$form['target'] = array(
'#prefix' =&gt; '&lt;div id="newuser"&gt;' ,
'#value' =&gt; drupal_add_js('alert("hello)','inline'),
'#suffix' =&gt; '&lt;/div&gt;'


);
drupal_add_js() is for adding script tags to the page.
It doesn't go in a form element.

 drupal_add_js('alert("Hello!")', 'inline');


would go by itself on a line. This would add that javascript to the page, so when the page loads you would get a pop-up that says "Hello".

and/or to add markup to the page you would do this:

$form['target'] = array(
  '#prefix' =&gt; '&lt;div id="newuser"&gt;',
  '#value' =&gt; t('Hello'),
  '#suffix' =&gt; '&lt;/div&gt;'
);


Which would add the text "Hello" to the form in the newuser div.