Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • string manipulation & PDF file

    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 905
    Answer it

    First of all, thank you for trying to help me. It should be simple , but I think I am missing something

    I have an HTML file that it’s used to produce a pdf file and gets date from a screen selection

    It is about string manipulation (extraction a substring that starts with “[“ from a string and displaying the result )

    Example instead of Van5[15] it’s supposed to display Van

    The HTML file is:

    <html>
    
    <head>
    
    <script>>// <![CDATA[
    
    function extract() {
    
     var room=[RoomName]
    
     return str.substring(0, str.lastIndexOf("["));   
    
     }                    
    
     document.getElementById("demo").innerHTML = extract();
    
    // ]]></script>
    
    </head>
    
    
    <body onload="extract()">
    
    <table>
    
            <tr>
    
                <td colspan="2" style="text-align:center; font-size:80;color:White; font-family:Verdana; font-weight:bold;border:1px solid Black;">
    
                    T</td>
    
            </tr>
    
            
    
            <tr>
    
                <td colspan="2" style="text-align:center; font-size:80; font-family:Verdana; font-weight:bold;border:1px solid Black;">
    
                    &nbsp;</td>
    
            </tr>
    
            <tr>
    
                <td colspan="2" style="text-align:center; font-size:60; font-family:Verdana; font-weight:bold;border:1px solid Black;">
    
                    [RoomName]
    
                                                   
    
                    <p id="demo"></p>    
    
    
                </td>
    
            </tr>
    
            <tr>
    
                <td colspan="2" style="text-align:center; font-size:29;font-family:Verdana;font-weight:bold;border:1px solid Black;">
    
                    [ClassName]
    
                </td>
    
            </tr>
    
           
    
            <tr>
    
                <td colspan="2" style="text-align:center; font-size:20;font-family:Verdana;font-weight:bold;border:1px solid Black;">
    
                    [Date]
    
                </td>
    
            </tr>
    
           
    
        </table>
    
    
    </body>
    
    </html>

     

    The output(pdf file ) looks like this:

    ---------------------------------------------------------------------------------

    The <script>

    var room=Van5 [15];

    return str.substring(0, str.lastIndexOf("["));

    }

    document.getElementById("demo").innerHTML = extract();

     

    should display Van5

    (Note: data for  [RoomName], [ClassName], [Date]  are variables that comes from a previous screen)

     

 1 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: