Welcome to WebmasterWorld Guest from

Forum Moderators: brotherhood of lan & mack

Message Too Old, No Replies

Using Comments to Deactivate Code

HOW - simply, easily comment out code



12:01 am on Mar 6, 2004 (gmt 0)

10+ Year Member

Hi - I am a beginning HTML coder. To test alternate ways of coding a line - I copy the line and comment out one of the lines to deactivate it, and then make changes to the other line. Then I revalidate to see if I get any differences.

It seems to me that there should be a simple way to select the line (using the cursor) - and then say 'format this selected text as a comment'. Comment start and end tags would be inserted at the beginning and the end of the line.

I use either Topstyle, or Homesite as my HTML editor. This seems to me as a simple learning tool - does anyone know if such a tool / plugin, etc., is available in ay editor?

Thank you in advance.



12:05 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

Never used TopStyle or HomeSite but any decent text editor should support macros and search-and-replace with regular expressions.

So basically refer to your help file for how to record a macro that replaces the selected text with <!-- text -->


12:23 pm on Mar 6, 2004 (gmt 0)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

In TopStyle use the key combination:
Ctrl + Shift + M
That will comment out whatever you have selected. This works in the HTML and CSS editors.


5:53 pm on Mar 8, 2004 (gmt 0)

10+ Year Member

Ctrl + Shift + M also works in HomeSite. Simply highlight the section of code, then Ctrl + Shift + M to comment it out. CTRL + Z will undo, making it pretty easy to toggle back/forth.


10:06 pm on Mar 12, 2004 (gmt 0)

10+ Year Member

Thank you very much for the responses.. I certainly have had a DUH moment... I checked help, but I did not check the Edit menu and other menus completely. Thank you again for setting it straight.



3:36 am on Mar 14, 2004 (gmt 0)

10+ Year Member

It's also pretty easy to do in Textpad, at textpad.com. It has macro's, macro programming on the fly, clip libraries, massive and speedy file search and replace.

There are a ton of addons, to ftp the file you are working on to your destination and so on...

It's why i stick with it since 1997.


Featured Threads

Hot Threads This Week

Hot Threads This Month