|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a confusion.
Why use use comments in javascript like <!-- ... //-->. Without this our codes runs successfully, then what is the benifit of it. Thanks Burhan |
|
#2
|
||||
|
||||
|
Traditionally, that's what's been done to hide javascript code from browsers that can't parse javascript. If a browser can parse js, it ignores the comments. If it can't, the comments keep the browser from seeing the js and printing it out.
__________________
Please don't PM me asking for solutions outside the scope of a thread. Keeping all responses in a thread stands to help others who come along later, which is after all what this forum's all about. |
|
#3
|
|||
|
|||
|
Quote:
Thanks dhouston. There are many browsers. Some support javascript and some not. Then what is average, is <!-- ... --> should be use as a average. Thanks Burahn |
|
#4
|
||||
|
||||
|
I'm not sure I understand your follow-up question. I think you're asking if you should use the <!-- ... --> comment tags to accommodate the browsers that don't support javascript. Sure, go ahead and do that. More importantly, make sure any functionality that the javascript handles is extra. That is, browsers that don't handle javascript should also be able to display your site properly.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Why use <!-- ............... //--> |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|