In my HTML document I have JS Code for calling a JS document:
"createHeader("Diskurs18E.htm", "Notrnslt.htm", "Diskurs18.htm");"
In the JS document I post code for HTML with "function create.. document.write"
"function createHeader (Header1URL, Header2URL, Header3URL) {"use strict";
document.write(' <table class="Verdana..."
But here I got the CSE validator errors
[JSHint] Problem: implied global: document
[JSHint] Problem: unused variable: createHeader
[JSHint] Problem: document.write can be a form of eval.
What can I do to correct these errors in CSE-Validator?
Thanks and regards
Friedrich
JS document.write can be a from of eval
- Albert Wiersch
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
- Contact:
Re: JS document.write can be a from of eval
Hello,
Here is the page on JSHint options:
http://jshint.com/docs/options/
For the implied global message, you can tell JSHint you will be using browser globals by using this option: "--browser=true". Add that to the 'Options' string in the JSHint page of the Validator Engine Options. Alternatively you could add this comment to the top of your JavaScript document:
For the unused variable message, you can tell JSHint about global variables that are defined in the current file but used elsewhere by adding this to the top of the JavaScript document:
To specify more than one variable, separate with commas like this:
For 'document.write can be a form of eval.', here's a good link:
http://www.jameswiseman.com/blog/2011/0 ... m-of-eval/
You can right-click and disable that message if you want. In future updates I've made it a warning and added a message ID so the message can be changed or disabled that way if you don't want to see it anymore.
As for document.write, it should be avoided if possible. See the info about it here:
http://stackoverflow.com/questions/1504 ... rm-of-eval
Here is the page on JSHint options:
http://jshint.com/docs/options/
For the implied global message, you can tell JSHint you will be using browser globals by using this option: "--browser=true". Add that to the 'Options' string in the JSHint page of the Validator Engine Options. Alternatively you could add this comment to the top of your JavaScript document:
Code: Select all
/* jshint browser:true */
Code: Select all
/* exported createHeader */
Code: Select all
/* exported export1,export2,export3 */
http://www.jameswiseman.com/blog/2011/0 ... m-of-eval/
You can right-click and disable that message if you want. In future updates I've made it a warning and added a message ID so the message can be changed or disabled that way if you don't want to see it anymore.
As for document.write, it should be avoided if possible. See the info about it here:
http://stackoverflow.com/questions/1504 ... rm-of-eval
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial