Please help modify script to comply for embed in webpage

I need to embed a booking service into my webpage. I got the javascript to doit but when I insert it Ijust get a blank page. After running the code through a validator it turns out there are some errors ornon compliance. Can youplease hep me makeit compliant and run

<script type="text/javascript">
	<!--
    _fez_account = "44dab3cc-0f1e-480e-bb16-748eb7607d4b";
    _fez_brand = "1";
    _fez_rest = "";
    _fez_width = "100%";
    _fez_height = "100%";
    _fez_scrolling = "no";
    _fez_anal = "";
    _fez_stylesheet = "http://bookings.liveres.co.uk/css/responsive_demo1.css";
    _fez_mobile = "no";
    _fez_ascript = "0";
    _fez_head = "Table Reservation";
    _fez_desc = "";
    _fez_offer = "";
    _fez_offerpopup = "1";
    _fez_partner = "";
    _fez_restaurantpicker = "";
    _fez_daymarketingpopup = "1";
    _fez_offerpicker = "";
    _fez_offerpopupchoosefullprice = "1";
    _fez_choosefullprice = "1";
-->
</script>
<script type="text/javascript" src="http://bookings.liveres.co.uk/scripts/fez.js"></script>

Thank you

Can you please share the errors?

What is this HTML comment doing here?
I guess it shouldn’t be there.

Line Col Errors
1 1 Expected an identifier and instead saw β€˜<’.
1 1 Expected an assignment or function call and instead saw an expression.
1 2 Missing semicolon.
1 2 Expected an assignment or function call and instead saw an expression.
1 8 Missing semicolon.
2 5 Expected an identifier and instead saw β€˜<’.
2 6 Expected an operator and instead saw β€˜!’.
2 7 Expected an operator and instead saw β€˜β€“β€™.
2 7 Unrecoverable syntax error. (7% scanned).

Thank you for your reply, above are some of the errors/warnings found

These errors are for <!-- only

Are you sure you need not declare these variables here?

Hello. Thanks again

I am a ways out of my knowledge range here on how to reformat the code

on http://www.csgnetwork.com/htmlcodetest.html or http://tessisamess.com/codetester

the code is accepted and runs as intended but in most others it just gets an error

I removed the comment tags but the number of errors went up up instead of down

Line Col Errors
1 1 Expected an identifier and instead saw β€˜<’.
1 1 Expected an assignment or function call and instead saw an expression.
1 2 Missing semicolon.
1 2 Expected an assignment or function call and instead saw an expression.
1 8 Missing semicolon.
2 18 Bad assignment.
2 19 Missing semicolon.
2 20 Expected an assignment or function call and instead saw an expression.
22 2 Unclosed regular expression.
22 2 Unrecoverable syntax error. (95% scanned).

html tags are invalid code inside script tags. Remove the html comment from inside the script tag.

In javascript you also need to declare all your variables with let or const


Also, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://www.freecodecamp.org/learn.

Happy coding :slight_smile:

I’m unable to test on these sites, due to some cross-site issue,
but the errors are with HTML comment tag(<!--, -->) and undeclared variable as mentioned by @ilenia and me earlier

Hello, how do I define it, please?

It seems to work just fine for me, it creates the iframe and adds the data from the variables.

  1. You may have to check the height you set on _fez_height, it is possible that the iframe is collapsed. You can add a fixed height in pixels or make sure the iframe is getting the height from its parent element. You might try adding a height to the html/body in the CSS.
html, body {
  height: 100%;
}
  1. Use https for the links to the script and CSS files
https://bookings.liveres.co.uk/css/responsive_demo1.css
https://bookings.liveres.co.uk/scripts/fez.js

The tests you have linked to are not something I would suggest you use.

1 Like

Thanks, your edit has fixed the issue now. The script now loads as intended