Answer the question
In order to leave comments, you need to log in
Mysterious SintaxError: what is the error?
I will not understand in any way why in twenty times checked up and couple of times the rewritten code the syntactical error takes off:
SyntaxError: missing ; before statement after var fb.widgets = d.querySelectorAll('.hLike.facebook');
var d = document;
var url = d.location.href;
var s = 'script';
var firstScript = d.getElementsByTagName(s)[0];
/* fb */
var fb = {
id: 'facebook-jssdk',
appId: '1550284425231361'
};
var fb.widgets = d.querySelectorAll('.hLike.facebook');
//На месте сего коммента SyntaxError: missing ; before statement
for(var i in fb.widgets) {
var widget = fb.widgets[i];
var widgetFrame = d.createElement('div');
widget.appendChild(widgetFrame);
widgetFrame.class = 'hLike-frame fb-like';
widgetFrame['data-href'] = url;
widgetFrame['data-layout'] = 'button';
widgetFrame['data-action'] = 'like';
widgetFrame['data-show-faces'] = 'false';
widgetFrame['data-share'] = 'true';
}
if (!d.getElementById(id)) {
fb.js = d.createElement(s); fb.js.id = fb.id;
if(!d.getElementById('fb-root'))
fb.root = d.createElement("div"); fb.root.id = 'fb-root';
fb.js.src = "//connect.facebook.net/ru_RU/sdk.js#xfbml=1&version=v2.5&appId=1"+fb.appId;
firstScript.parentNode.insertBefore(fb.js, firstScript);
}
//......
Answer the question
In order to leave comments, you need to log in
Probably the text of the error and where it crashes is completely unnecessary information!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question