Javascript

Example shows dynamically creating embroidery lettering in javascript and launching in stitch player

Below is full source for javascript example shown above  Download Source here

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Javascript Sample</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
    <script type="text/javascript">
        var username = "";
        function UpdateImage()
        {
            var text = $('#Text1').attr("value");
            $('#TestImage').attr("src", LDWSAddAuthToUrl("http://api.livedesigner.com/"+username+"/GetImage/Lettering?alphabet=DIANE%20SCRIPT&text="+text+"&color=ccaa00&dpi=72"));
        }
       function GetStitchPlayer() {
           var text = $('#Text1').attr("value");
           window.open(LDWSAddAuthToUrl("http://api.livedesigner.com/" + username + "/StitchPlayer/Lettering?alphabet=DIANE%20SCRIPT&text=" + text + "&color=ccaa00&ViewWidth=400&ViewHeight=300"), 'StitchPlayer', 'width=400,height=300');
       }
       $(document).ready(function() {
           $.getScript('http://api.livedesigner.com/' + username + "/LDWSAuthJS", function() { UpdateImage() });
           if (username.length == 0) $('#ErrorLabel').append("In order to use this example you'll need to specify username in this file and add this domain to list of allowed domains at Account Management");
       });
    </script>
</head>
<body>
    <div id ="ErrorLabel">
   
    </div>
    <input id="Text1" type="text" value="Hello"/><input id="Button1" type="button"
        value="button" onclick="javascript:UpdateImage()"/>
        <a href="#" onClick="javascript:GetStitchPlayer()">Launch Stitch Player</a>
    <p>
        <img id="TestImage" alt="" src="" /></p>
</body>
</html>