home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 3097
Discussions: 188,376, Posts: 2,243,445, Members: 232,604
Old July 25th, 2002, 10:34 AM   Digg it!   #1 (permalink)
Member
 
Join Date: Dec 2001
Posts: 68
commenting out a block of code?

I know that <!-- some html code -->

will comment out that line of code, but what if I want to comment out a large block of code? Do i have to do that at beggining and end of each line? ugh.

hawkman2 is offline   Reply With Quote
Old July 25th, 2002, 10:37 AM     #2 (permalink)
Ultimate Member
 
Agent_Embryo's Avatar
 
Join Date: Oct 2001
Location: Sweden
Posts: 1,708
Send a message via ICQ to Agent_Embryo
no. just do it at the beginning and the end of the code you want blocked out.
__________________
This is The SignatureŠ
www.ghostnail.com - my band.

Agent_Embryo is offline   Reply With Quote
Old July 25th, 2002, 10:49 AM     #3 (permalink)
Member
 
Join Date: Dec 2001
Posts: 68
Hmm I tried that and it didnt work. Is it something different for javascript?

hawkman2 is offline   Reply With Quote
Old July 25th, 2002, 11:09 AM     #4 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
Code:
<!--

<br>
<font color="#ffffff">
<u>This is commented out</u>
</font>

-->
Make sure there are no other -->

before your ending --.
__________________
USA Linux Users Group
OpenSUSE.us
crouse is offline   Reply With Quote
Old July 25th, 2002, 11:17 AM     #5 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
For JavaScript

Original Code

Code:
<script type="text/javascript">
<!--   // Array ofmonth Names
var monthNames = new Array( "January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(monthNames[now.getMonth()] + " " + now.getDate() + ", " + thisYear) ;
// -->
</script>

Code Commented out below-----------
Code:
<!--   // Array ofmonth Names
var monthNames = new Array( "January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(monthNames[now.getMonth()] + " " + now.getDate() + ", " + thisYear) ;
// -->
just remove the Script tags..... that should solve your problem

HTH's
crouse is offline   Reply With Quote
Old July 25th, 2002, 07:35 PM     #6 (permalink)
Junior Member
 
Join Date: Apr 2002
Posts: 29
Or, you can do this:
Code:
<script type="text/javascript">
<!--
/*var monthNames = new Array( "January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
thisYear = now.getYear();
if(thisYear < 1900) {thisYear += 1900}; // corrections if Y2K display problem
document.write(monthNames[now.getMonth()] + " " + now.getDate() + ", " + thisYear) ;*/
// -->
</script>
// is only for one line, /*...*/ can be used for more than one line
Wynd is offline   Reply With Quote
Old July 25th, 2002, 09:58 PM     #7 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
Um........ that was originally one line of code........ broke down to display........

I think he was trying to figure out how to comment out a block of code.......... so it didn't work............ but wasn't totally erased........ your way would still run the javascript.....
crouse is offline   Reply With Quote
Old July 26th, 2002, 12:31 AM     #8 (permalink)
Senior Member
 
Join Date: Oct 2001
Location: Alberta, Canada
Posts: 563
Wynd is right actually... in javascript you can comment one line of code with // or you can comment a block/section/line of code by enclosing it in /* ... */

as in the following (red will not run, green will run)

(one line)
/* ...some code... */
or
(one line)
// ...some code...

(multiple lines)
/* ...some code...
...some more code...
...some more code...
*/

or even (section in one line, not really recommended tho!!)
...some code /* ...some commented out code... */ ...some more code here too...

I could be missing something, but I really can't see that being one line of code anyways (not to say your wrong crouse) or if it was, imo, poor coding practice... but even if it was one line, it still looked to be commented out properly...

anyways, cheers!
^hyd^ is offline   Reply With Quote
Old July 26th, 2002, 12:50 AM     #9 (permalink)
Ultimate Member
 
crouse's Avatar
 
Join Date: Jun 2002
Location: Iowa
Posts: 2,879
Send a message via ICQ to crouse
I stand corrected

I'm not a javascript guru..... I looked.... you guys are right ... that would do it also...
crouse is offline   Reply With Quote
Old July 26th, 2002, 10:38 AM     #10 (permalink)
Member
 
Join Date: Dec 2001
Posts: 68
Thanks gang, that did it! Ok who wants to launch commentout.com that lists how to comment out for all the languages?
hawkman2 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2882)
The United States Debt (20)
Looks like Burris will get his Sena.. (7)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
Folderchat Weekday thread (439)
Antec 300 bulk purchase? (11)
Worth the upgrade?? (14)
Titan quest and Immortal Throne, an.. (17)
Recent Discussions
Folderchat Weekday thread (439)
New Build ( Finally ) (0)
MSN Hotmail Down??? (7)
Help with an Ati Radeon HD 4850.. (23)
Laptop waking up itself (0)
CPU wont boot (3)
Best digital camera for under 2.. (13)
Building first computer, will t.. (2)
get this error, "res://C:\.. (73)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 07:53 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28