VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   trying to concat two variables and I am recieving the following error: ReferenceError (https://forums.vandyke.com/showthread.php?t=13983)

gawe99 11-22-2019 04:48 AM

trying to concat two variables and I am recieving the following error: ReferenceError
 
I am trying to concat two variables and I am recieving the following error: ReferenceError: str is not defined

I understand that I need to declare the var "var contents = str.concat(title,contentBody);" but I am unsure how best I do this.

Here is my function.




function printDiv() {
var title = $("#document-header").html();
var contentBody = $("#document-content").html();
var contents = str.concat(title,contentBody);
frame1[0].name = "frame1";
frame1.css({ "position": "absolute", "top": "-1000000px" });
$("body").append(frame1);
var frameDoc = frame1[0].contentWindow ? frame1[0].contentWindow : frame1[0].contentDocument.document ? frame1[0].contentDocument.document : frame1[0].contentDocument;
frameDoc.document.open();
//Create a new HTML document.
frameDoc.document.write('<html><head><title>Dev page</title>');
frameDoc.document.write('</head><body>');
//Append the external CSS file.
frameDoc.document.write('<link href="/css/hmtheme.css" rel="stylesheet" type="text/css" />');
//Append the DIV contents.
frameDoc.document.write($("#document-content").html());
frameDoc.document.write('</body></html>');
frameDoc.document.close();
setTimeout(function () {
window.frames["frame1"].focus();
window.frames["frame1"].print();
frame1.remove();
}, 500);
};
</script>

bgagnon 11-22-2019 11:10 AM

Hi gawe99,

This particular scripting forum is specifically set up for discussion of scripting techniques that are applicable to VanDyke Software products.

Because your question is not VanDyke Software specific, you might consider posting the same question to a forum more generally focused on scripting.


All times are GMT -6. The time now is 02:15 AM.