Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    coding your text

    I know we should always code our script. I am worried about over coding....Tell me what you think of this small script:
    PHP Code:
    <script language="javascript">
    <!--
    /*******************************************************
    **            Get Rid of Box Around Links!            **
    ********************************************************
    ** This Script will remove ** Cycles through all the  **
    ** the box that appears    ** links in the page and   ** 
    ** around links whenever   ** adds this line to it:   **
    ** you click them.         ** onFocus="this.blur();"  **                   
    *******************************************************/
    onload = function() {
    a_tags=document.getElementsByTagName('a')
    for (
    i=0;i<a_tags.length;i++) {
    a_tags[i].onfocus=blur_links
    }
    }

    function 
    blur_links() {
    this.blur()
    }
    /*******************************************************
    **         END - Get Rid of Box Around Links!         **
    *******************************************************/
    //-->
    </script> 
    Does that look "over coded"?

  • #2
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    man, that looks bad

    try this:
    Attached Files Attached Files

  • #3
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    I think the comments are a little over loaded.
    Try getting rid of some of those asterisks.

    I personally like to have block comments.

    /* Like you have your
    explanation of the script
    in here */
    Omnis mico antequam dominus Spookster!

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Depends on the time of year
    Posts
    478
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's true, for a real small script such as yours, the commenting is excessive, try to keep the commenting less than the code.

    Also, you might want to look at the indenting, for later on when you have to nest a lot of stuff.

    Otherwise your code itself is not excessive, as long as it gets the job done, and you keep it on the minimum duration of big Oh.

    Duniyadnd

  • #5
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    For web scripting languages comments right now should be kept to a minimum and only as necessary. Necessary meaning explain in optional or confiruation portions of the script that they user needs to modify in order to use it. Every extra character you put in is another character that has to be downloaded.

    In standalone software programming using a high level language it is just the opposite....plenty of comments are good to explain each piece of coding.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #6
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    right now
    Omnis mico antequam dominus Spookster!

  • #7
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,280
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Originally posted by Mhtml
    oh yeah I forgot to expand on that thought. lol I meant right now as in since not everybody is using broadband connections. If everybody is using broadband connections then having a script that has 50k of comments for example won't really be a big deal.
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #8
    Banned
    Join Date
    Mar 2003
    Posts
    224
    Thanks
    0
    Thanked 0 Times in 0 Posts

    well,

    I am worried about filesize. So, I just plan to keep a very commented version on my C:// and remove comments as I put ti up for webpage


  •  

    Posting Permissions

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