title: Unexpected Token Illegal with onclick Java Script in Salesforce.com
body: <p>I have been working on this most of the morning but to no end.  I am trying to execute a button that uses OnClick Java in Salesforce.com and it keeps throwing errors.  I think the issue may be with special characters in the data as it works when I simply use just text.  But any time numbers or any special characters are present I get the error "unexpected token ILLEGAL".  Can anyone help me to see what I am doing wrong and how I can get away from failing when special characters are involved?</p>
  
  <pre><code>{!REQUIRESCRIPT("/soap/ajax/28.0/connection.js")} 
  
  
  var opptyObj = new sforce.SObject("Opportunity");
  var caseObj = new sforce.SObject("Case");
  var today = new Date();
  var sOpptyId = "{!Case.Opportunity__c}";
  
  if( sOpptyId != "")
  { 
  alert("This case is already tied to an opportunity!");
  } 
  else
  { 
  opptyObj.AccountId = "{!Case.AccountId}";
  opptyObj.CloseDate = sforce.internal.dateTimeToString(today);
  opptyObj.Description="{!Case.Description}";
  opptyObj.Case__c = "{!Case.Id}";
  opptyObj.Name = "{!Case.Subject}";
  opptyObj.StageName = "Estimate in Progress";
  opptyObj.Created_from_Case__c = "Y";
  opptyObj.Type = "New Business";
  opptyObj.Amount = ".01";
  
  var opptyresult = sforce.connection.create([opptyObj]);
  
  if (opptyresult[0].success=='false') 
  { 
  alert("Opportunity creation failed: " + opptyresult[0].errors.message);
  } 
  else 
  { 
  caseObj.Id = '{!Case.Id}';
  caseObj.Opportunity__c = opptyresult[0].id;
  caseObj.Status = "Estimate in Progress";
  
  var caseResult = sforce.connection.update([caseObj]);
  
  if(caseResult[0].success == 'false') 
  { 
  alert("Case update failed: " + caseResult[0].errors.message);
  } 
  else 
  { 
  alert("An opportunity has been created and linked to this case.");
  location.reload(true);
  } 
  } 
  }
  </code></pre>