Can someone check my JS?
Jul 07, 2015
Hiya,
Could someone please check this javascript please, it's not running properly:
var myWindow = window.open(""," Print","width=810,height=610,menubar=1,scrollbars=1,resizable=1, toolbar=1");
var player=GetPlayer();
var unotes1 = player.GetVar("TextEntry1");
unotes1 = unotes1.replace(/\r\n/g, '<br />').replace(/[\r\n]/g, '<br />');
var contents = "<html><head><title>What I know about FMEA</title></head>
<body style='width:650px;padding:20px;'>"
contents+="<div style='font-size:17px;margin-top:20px; margin-bottom:20px; font-family:Helvetica, Arial, sans-serif;line-height:22px;'><img src="images/logo.png"/></div>";
contents+="<div style='font-size:17px;margin-top:20px; margin-bottom:20px; font-family:Helvetica, Arial, sans-serif;line-height:22px;'>What I know about FMEA</div>";
contents+="<div style='font-size:17px;margin-top:20px; margin-bottom:20px; font-family:Helvetica, Arial, sans-serif;line-height:22px;'>"+unotes1+"</div>";
contents+="</body></html>"
myWindow.document.write(contents);
myWindow.document.close();
myWindow.focus();
myWindow.print();
3 Replies
Hi, Megan - You may already be aware of this, but I wanted to note that Articulate does not provide support for JavaScript coding, however, it may be helpful to take a look at this document on JavaScript Best Practices. Hopefully, some of our JS experts in the community can chime in with input!
Give this a try:
I think the problem was this:<body style='width:650px;padding:20px;'>" was added as a second line when it should have been part of the string on the previous line
Your input is appreciate, Jackson! :) Megan, please let us know if that does the trick!
This discussion is closed. You can start a new discussion or contact Articulate Support.