Evario
11-20-2007, 08:30 AM
Hi have the following code:
var quote = document.getElementById('acc_quoteInfo').innerHTML;
document.getElementById(id).deleteCell(0);
document.getElementById(id).deleteCell(0);
oCell = document.getElementById(id).insertCell(-1);
oCell.innerHTML = '<div style="margin-left: 73px; margin-top: 20px; color: #999999;">- Maximum 50 characters allowed.<br /> - Submit with a blank field to clear your quote.</div><form name="Account_Quote" id="Account_Quote"><div id="acc_emailCurrent">New Quote:<input name="quote" type="text" maxlength="50" class="acc_emailField" style="margin-left: 37px;" /></div><div class="acc_email" style="margin-top:10px;"><a style="width: 30px; font-size:20px; color:#99B731;" href="#" onclick="validateAccount(\'quote\'); return false;">Update</a></div><div class="acc_email" id="acc_quoteValidate" style="margin-top: 10px; color:#FF0000;"></div>';
document.getElementById('acc_quoteC').innerHTML = '<span style="cursor:pointer;" onclick="details_hide(\'acc_quote\', \''+quote+'\')">Hide</span>';
I have highlighted the problem code in red. Basically the var quote will be something of the form "This is my quote" (with the quotation marks) and this produces an error the way I have it coded because the javascript gets confused with the ' and " characters. How do I fix this?
Thanks,
Marc
var quote = document.getElementById('acc_quoteInfo').innerHTML;
document.getElementById(id).deleteCell(0);
document.getElementById(id).deleteCell(0);
oCell = document.getElementById(id).insertCell(-1);
oCell.innerHTML = '<div style="margin-left: 73px; margin-top: 20px; color: #999999;">- Maximum 50 characters allowed.<br /> - Submit with a blank field to clear your quote.</div><form name="Account_Quote" id="Account_Quote"><div id="acc_emailCurrent">New Quote:<input name="quote" type="text" maxlength="50" class="acc_emailField" style="margin-left: 37px;" /></div><div class="acc_email" style="margin-top:10px;"><a style="width: 30px; font-size:20px; color:#99B731;" href="#" onclick="validateAccount(\'quote\'); return false;">Update</a></div><div class="acc_email" id="acc_quoteValidate" style="margin-top: 10px; color:#FF0000;"></div>';
document.getElementById('acc_quoteC').innerHTML = '<span style="cursor:pointer;" onclick="details_hide(\'acc_quote\', \''+quote+'\')">Hide</span>';
I have highlighted the problem code in red. Basically the var quote will be something of the form "This is my quote" (with the quotation marks) and this produces an error the way I have it coded because the javascript gets confused with the ' and " characters. How do I fix this?
Thanks,
Marc