Computer geek, and self-appointed know-it-all, Westley Annis answers all those hard 

questions about anything related to computers and technology, as well as business and 

political questions.

MovableType is Killing My Scripts

When I include some JavaScript code into one my blog entries, even with Text Formatting turned off, MovableType is still add
tags. How can I stop this?

Setting the Text Formatting option to Convert Line Breaks is the default setting for MovableType and, most likely, all other blog software also. It allows the author to ignore the needed HTML code to separate paragraphs.

As you have discovered, sometimes you don't want the blogging software to automatically add the HTML code. It would seem that setting the Text Formatting option to None would do the trick, but it isn't quite that easy.

Whether it is a bug or a feature, MovableType will look at the contents of your entry, especially any HTML tags and use that as the deciding factor as to whether or not to convert line breaks.

MovableType will stop converting line breaks when it encounters any of the following HTML tags:


  • h1, h2, h3, h4, h5, h6

  • table

  • ol, dl, ul

  • menu

  • dir

  • p

  • pre

  • center

  • form, fieldset, select

  • blockquote

  • address

  • div

  • hr

This means you could wrap your JavaScript code inside of a <div> or <center> element, but you must be careful. If you have one blank line, MovableType will start converting line breaks again. Also, be sure you put all of the JavaScript code inside of element, including the JavaScript header, as shown below:

<center>
<script language="javascript" type="text/javascript">
<!--
function myFunction()
{
    myCode
}
// -->
</script>
</center>
Category is Internet/Web Services   (Article #100)
Comments
This site is incredible!
This site is incredible! It's amazing the questions you get asked and you always come up with the answer. I've just got to help you stay cool by buying you a Snoball!
I do have a comment, now that you mention it!









Remember personal info?


Please note that I will never send you any unsolicited
email, period. I hate it just as much as you do.

Also note that by submitting a question or comment
you're agreeing to relinquish any subsequent rights of
ownership to your material by submitting it on this site.









Ask Westley your question on technology, business, or politics!
RDF XML
Add to My Yahoo!
Subscribe in 
NewsGator Online
Feedburner
Search



All Categories
Archives by Category
Book Links
Powered by
Movable Type 3.17
© 2005 by Westley Annis. All Rights Reserved.

Valid XHTML 1.0!