I have the code below in which I get a weird error.
function export_to_excel() { results_html = $('report_excel').innerHTML; results_html = '<html><body><table align="center" cellspacing="0" cellpadding="0" width="100%"><tr><td colspan="9"><b>Employee Salary Register </b></td></tr><tr><td colspan="9"></td></tr>' + results_html + '</table></body></html>'; var input = new Element('input', { 'type': 'hidden', 'name': 'results[html]', 'value': results_html }); var form = new Element('form', { 'method': 'post', 'name': 'Employee Salary Register', 'action': "html_to_excel" }); form.insert(input); document.body.appendChild(form); form.submit(); }
Error in this line
results_html = '<html><body><table align="center" cellspacing="0" cellpadding="0" width="100%"><tr><td colspan="9"><b>Employee Salary Register </b></td></tr><tr><td colspan="9"></td></tr>' + results_html + '</table></body></html>';
EDIT:
The error is displayed in the Firebug console pointing to this line. I just added a screenshot

Here you can see that under two buttons (print and export) the code appears on the screen. These lines of code are part of the export_to_excel() function
It works fine on my local server. I am using PrototypeJS and I apologize for the misrepresentation and sorry for the delay.
Any help would be greatly appreciated.
javascript html prototypejs ruby-on-rails-3
Pavan
source share