Forum Discussion
Javascript to print out content of Scrolling Panel in Storyline?
Hi all, my colleague helped me with an amazing javascript that allows you to print scrolling panels. The scenario in my slides is as follows: Students are presented with a question and a text field to enter their response. The next slide shows them a model answer and their response from the previous slide, WHICH THEY CAN PRINT. And it doesn't matter how long the texts are- it will print all. The javascript is as follows: (please note the 2nd and 3rd line- i.e. text1 and variable1- these must be changed accordingly. Good luck.
var player = GetPlayer();
var modelAnswer = player.GetVar("text1");
var yourAnswer = player.GetVar("variable1");
var mywindow = window.open('', 'Printing', 'height=400,width=600');
mywindow.document.write('<html><head><title>Printing</title>');
mywindow.document.write('</head><body >');
mywindow.document.write('<h2>Here is the Model Answer</h2>');
mywindow.document.write(modelAnswer);
mywindow.document.write('<h2>Here is Your Answer</h2>');
mywindow.document.write(yourAnswer);
mywindow.document.write('</body></html>');
mywindow.document.close(); // necessary for IE >= 10
mywindow.focus(); // necessary for IE >= 10
mywindow.print();
mywindow.close();
Here's an working example: http://samaree.com.au/moodle/mod/resource/view.php?id=58
Please login as guest to access the above resource.
Thank you very much Sam. Your explanation and the written example were very helpful as an inspiration.
However there is small problem with the printing of the model answers as they are not the input variables (I usually use a text box). How did you define the model answers in your Storyline?
Related Content
- 5 months ago