Certificate code help

May 14, 2014

Hi all,

I'm struggling to make this certificate work.  I have used two pieces of code, one to pull the user's name from Storyline, and another to pull the date stamp.  

For some reason during some tweak, the name stopped displaying.

Also the Date appears to be stuck on May 3 ??

Any help would be fabulous!

c

Here is the code: 

<!DOCTYPE HTML>

<HTML>

<HEAD>

<!-- saved from url=(0014)about:internet -->

<TITLE>Certificate</TITLE>

<STYLE>

#wrapper {

margin: auto;

width: 960px;

border-style: solid;

border-width: 20px;

-moz-border-image: url(border.png) 27;

-webkit-border-image: url(border.png) 27;

-o-border-image: url(border.png) 27;

border-image: url(border.png) 27;

}

#results {

position: relative;

margin: auto;

height: 1200px;

width: 800px;

font-family:cursive;

text-align: center;

color:#61503B;

z-index:2;

}

h1 {

font-size: 3em;

}

h2 {

font-size: 2.5em;

}

h3 {

font-size: 2em;

}

p {

font-size: 1.35em;

}

#logo1 img {

float: left;

width: 190px;

margin-right: 30px;

margin-top: 30px;

}

#logo2 img {

float: left;

width: 580px;

margin-top: 30px;

}

</STYLE>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

</HEAD>

<BODY>

<!-- <div class='bgimage'><img src='Certificate Vertical.jpg'/></div> -->

<div id="wrapper">

<SCRIPT>

// this grabs the player object from the parent (launching window)

var player=window.opener.GetPlayer();

// //now we pull a field value. You can pull as many as you like. That replace jumble lets you bring over text fields with multiple lines.

var learnerName=player.GetVar("learner").replace(/(\r\n|\r|\n)/g, '<br />');

    // learnerName = "Tex Morgan";

    function FormatDate()

{

var m_names = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");

var d = new Date();

var month = d.getMonth();

var date = d.getDay();

var year = d.getFullYear();

var d = m_names[month] + " " + date + ", " + year;

console.log(d);

return d;

}

var date = FormatDate();

    //grab timestamp in date format

document.write("<div id='results'><h1>Congratulations!</h1><h2>" + learnerName + "</h2><br><p>has successfully completed</p><br><h3>Module 1: Introduction to Veteran-Centered Brief Family Consultation in the Veteran-Centered Brief Family Consultation Training Series</h3><br><p>Completed On:</p><h2>" + date + "</h2><p>Training provided by the VA Desert Pacific Mental Illness Research, Education and Clinical Center (MIRECC) and the Family Services, Women’s Mental Health and Military Sexual Trauma Section of Mental Health Services of the Department of Veterans Affairs.</p><div id='logo1'><img src='va_circle_logo.png'></div><div id='logo2'><img src='va_rec_logo.png'></div></div>");

</SCRIPT>

</div>

</BODY>

</HTML>

Be the first to reply

This discussion is closed. You can start a new discussion or contact Articulate Support.