protected void writeJavaScript ( Header header ) throws IOException { addTabs ( 2 ) ; writeStart ( HtmlTags . SCRIPT ) ; write ( HtmlTags . LANGUAGE , HtmlTags . JAVASCRIPT ) ; if ( markup . size ( ) > 0 ) { /* JavaScript reference example: * * <script language="JavaScript" src="/myPath/MyFunctions.js"/> */ writeMarkupAttributes ( markup ) ; os . write ( GT ) ; writeEnd ( HtmlTags . SCRIPT ) ; } else { /* JavaScript coding convention: * * <script language="JavaScript" type="text/javascript"> * <!-- * // ... JavaScript methods ... * //--> * </script> */ write ( HtmlTags . TYPE , Markup . HTML_VALUE_JAVASCRIPT ) ; os . write ( GT ) ; addTabs ( 2 ) ; write ( new String ( BEGINCOMMENT ) + "\n" ) ; write ( header . getContent ( ) ) ; addTabs ( 2 ) ; write ( "//" + new String ( ENDCOMMENT ) ) ; addTabs ( 2 ) ; writeEnd ( HtmlTags . SCRIPT ) ; } }
Writes a JavaScript section or if the markup attribute HtmlTags . URL is set a JavaScript reference in the header .