By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,932 Members | 1,468 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,932 IT Pros & Developers. It's quick & easy.

In line comment //@@ gives Invalid character

P: 36
I have the following function in my javascript file
CODE:

Expand|Select|Wrap|Line Numbers
  1. function displayFullName(firstName, lastName) {
  2.   if(lastName != null) { //@@ Appnds only when last name exists
  3.     return (firstName + ' ' + lastName);
  4.   } else {
  5.     return firstName;
  6.   }
  7. }
  8.  
Here the inline comment gives me error "Invalid character".
When I remove @@ it works fine for me.

What is the reason behind this ?
May 16 '08 #1
Share this Question
Share on Google+
3 Replies


gits
Expert Mod 5K+
P: 5,390
i tested in firefox ... it works without an error ... with which browser does the error occur? is the script included in the page already or do you load it dynamically?

kind regards
May 16 '08 #2

P: 36
i tested in firefox ... it works without an error ... with which browser does the error occur? is the script included in the page already or do you load it dynamically?

kind regards
I am doing to work on IE 6.0.
First I tried with dynamically loading then I include initially itself. The error populates when the script inclusion happens.
May 16 '08 #3

gits
Expert Mod 5K+
P: 5,390
hi ...

i just tested it with IE6:

[HTML]
<script type="text/javascript">
function displayFullName(firstName, lastName) {
if(lastName != null) { //@@ Appnds only when last name exists
return (firstName + ' ' + lastName);
} else {
return firstName;
}
}
</script>
<body onload="alert(displayFullName(1,2));">
</body>
[/HTML]
worked without problems ... it might be a problem with another part of your code ... could you post a link to a testpage or test it yourself with firefox and have a look at the error-console to get a better error-description? the comment shouldn't make any problem ... in case it does and everything works ok!! when you remove it, then just remove it ... but i really think that there should be another problem ... as i said ... the code you currently posted is syntactically correct ...

kind regards
May 16 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.