SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Member
    Join Date
    May 2000
    Location
    Peterborough, Ontario, Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just wondering if you guys think that when you see alot of 'mm' javascript stuff in source code that it:

    1) indicates the use of Dreamweaver behaviours
    2) is usually far too bloated

    example:

    "function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    George

  2. #2
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is proprietary Macromedia javascript code. The reason why it is bloated is becuase it is a global script that can perform many tasks, and works in many browsers. IF you prefer no to see it, just cut it out and dump it in an external file. Then you can refer to it in other documents also without the client having to reload it.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  3. #3
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I can always spot Dreamweaver code a mile away. It si quite funny when my students swear they did their work in NotePad but you can really tell if they didn't

  4. #4
    Fluffy Kitten Programmer~ Elledan's Avatar
    Join Date
    Jun 2000
    Location
    Netherlands
    Posts
    1,356
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nicky, I don't think that it would be exaggerated to say that you can smell Word HTML code from half a light-year away

    I personally think that DreamWeaver codes very neat, and in most cases even better than the average person could do manually.
    www.nyanko.ws - My web-, software- and game development company.
    www.mayaposch.com - My personal site and blog.

  5. #5
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    ahhhhhhhhh, Word code - it stinks (literally)

  6. #6
    SitePoint Zealot Megs's Avatar
    Join Date
    Oct 2000
    Location
    Kitchener, Ontario
    Posts
    179
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think:

    1. This page was made with Dreamwevaer. Good choice.
    2. Either
    a) the designer doesn't know that DW writes bloated javascript
    b) the designer doesn't know Javascript and therefore must use DW's behaviors to add scripting or
    c) the author wanted to save time by using DW's built-in scripts rather than writing thim him/herself.

    There's nothing wrong with any of the above if you ask me. It could be a lot worse.

    Megan Jack
    Proud to be Canadian
    http://www.meganjack.com
    Moderator at The Webmaster Forums and EDevCafe Forums

  7. #7
    SitePoint Addict gthorley's Avatar
    Join Date
    Oct 2000
    Location
    Canada
    Posts
    392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice clean looking site Megan. All it needs is a wavy Canadian flag gif.

    If you want one let me know or you can grab one of our new site index page which is in test stage.
    http://www.artbyjudy.com/test/index11.html

    Another proud Canuck

  8. #8
    SitePoint Wizard dominique's Avatar
    Join Date
    Dec 2000
    Location
    orbis terrarum
    Posts
    1,523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, this is turning into the all canadian post!

    I was wondering if cckrocks or anyone else could tell me how do call js code in an external file since I don't know any javascript (rather unfortunately).

    Thanx a lot!

    Canada all the way baby!
    (They should put the canadian flag in the smilies list, just a thought...)

  9. #9
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just take all the code between the <script blah, blah, blah> and </script> tags and move it into a separate text file and name it with the extension ".js" like rollover.js for example. Then all you need to do is write 1 line to call the script. Here's a lot of code, but it's actually with a Macromedia rollover script...
    Code:
    ...
    <head>
    <title></title>
    <script type="text/JavaScript" src="javascript/rollover.js"></script>
    </head>
    ...
    and here's the actual .js file (notice you don't need the <script></script> tags inside the file...
    Code:
    <!--
    function MM_swapImgRestore() { //v3.0
      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
    }
    function MM_preloadImages() { //v3.0
      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }
    function MM_findObj(n, d) { //v3.0
      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
    }
    function MM_swapImage() { //v3.0
      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
    }
    //-->
    and there it is, laid out for you. All you have to do is change the path to the file to wherever you put the file. Sorry to Macromedia for posting their code, but you can get it just about anywhere.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  10. #10
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not from Canada
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  11. #11
    SitePoint Member
    Join Date
    May 2000
    Location
    Peterborough, Ontario, Canada
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey CCKROCKS
    I want to do the '.js in a separate file thing' for a date script, but the script sits inside a table in the body (rather than in the head) so I can place it in a specific spot. My question is - how would I call the script so it is still located in the correct spot?

    thanks
    George
    another spy for Canada

  12. #12
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You just have to move the script call from the head to whereever you had the full script at. Just take the line:
    <script type="text/javascript" src="rollover.js"></script> and move wherever you need to call the script. Just make the src="xxxx.js" whatever the path of the external file is.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com

  13. #13
    SitePoint Zealot honging's Avatar
    Join Date
    Jan 2001
    Location
    Chapel Hill, NC
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't like Macromedia Dreamweaver too much... I still stick to Frontpage '98 for all my webdesigning purposes. True, it's not powerful, but it's great for nesting tables, which is what I use it for Plus it formats teh HTML neatly... it's funny though, because I have Dreamweaver installed for one purpose: rollovers. Gawd, I hate coding them rollovers

  14. #14
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by honging
    I still stick to Frontpage '98 for all my webdesigning purposes...Plus it formats the HTML neatly
    You are joking right?

  15. #15
    SitePoint Zealot cckrocks's Avatar
    Join Date
    Nov 2000
    Location
    A home in the hills where the grass grows green an
    Posts
    183
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I hope so too ...and coding rollovers is actually alot easier than it seems. Plus, the code is about 1/4 the size.
    Think beyond what is common...
    www.jaggedknife.com
    www.fusion-in.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •