drupal_add_js() for inline script
casey - November 23, 2006 - 12:26
| Project: | Database Administration |
| Version: | 4.7.x-1.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I was writing this issue with in mind that there are no comments in the scriptag produced by checkoff_head() (which is a problem for xhtml). Then I remembered the drupal_add_js() function; replace checkoff_head for:
[code]
drupal_add_js('function checkoff(form,toggle){var i=0;frm=document.forms[form];len=frm.elements.length;for(i=0;i

#1
hmm I used some some wrong markup.
drupal_add_js('function checkoff(form,toggle){var i=0;frm=document.forms[form];len=frm.elements.length; for(i=0;i<len;i++){if(frm.elements[i].type=="checkbox"){frm.elements[i].checked=toggle;}}}', 'inline');#2
Oww, inline is an 5.0 feature.
then it should be this for 4.7:
function checkoff_head(){return "<script type=\"text/javascript\"><!--function checkoff(form,toggle){ var i=0; frm=document.forms[form]; len = frm.elements.length; for( i=0 ; i<len ; i++) { if (frm.elements[i].type=='checkbox') { frm.elements[i].checked=toggle; } }} --></script>";
}
#3
can you attach a patch for this? http://drupal.org/diffandpatch
thanks!
-derek
#4
--project followup subject--
Automatically closed -- issue fixed for two weeks with no activity.
--project followup subject--
Automatically closed -- issue fixed for two weeks with no activity.
#5
Automatically closed -- issue fixed for two weeks with no activity.