...

View Full Version : coding your text



mattover-matter
03-31-2003, 02:55 PM
I know we should always code our script. I am worried about over coding....Tell me what you think of this small script:


<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"?

mattover-matter
03-31-2003, 02:57 PM
try this:

Mhtml
03-31-2003, 03:33 PM
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 */

duniyadnd
03-31-2003, 03:57 PM
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

Spookster
03-31-2003, 04:11 PM
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.

Mhtml
03-31-2003, 04:39 PM
right now
:confused:

Spookster
03-31-2003, 05:53 PM
Originally posted by Mhtml
:confused:

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.

mattover-matter
03-31-2003, 10:09 PM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum