Results 1 to 4 of 4
  1. #1
    camaross is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

    Default How to call javascript when the html is rendered from PERL

    My javascript works perfectly fine if I load the html using http web address. However, it quits working when I am rendering the html?
    I did some research and found that it is working when the page is loaded from http, because "JavaScript is executed on page load".
    When I render my html, my JavaScript are not automatically called.

    My question is how should I call the javascript in this situation?

    The html page:
    Java Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    
    <HTML>
    <HEAD>
    <Title>form</Title>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <link rel="stylesheet" type="text/css" href="xupload.css">
    </HEAD>
    <BODY>
    
    <form id="myform" enctype="multipart/form-data" action="/cgi-bin/upload.cgi" method="post" onSubmit="return StartUpload(this);">
    
    <DIV id="div1">
    <b><font id='x_max_files'>?</font> files <font id='x_max_size'>?</font> Mb total maximum</b>
    <div id="upload_input"><input id="my_file_element" type="file" name="file_1" size=58></div>
    <div id="files_list"></div>
    
    <p align=center><input type="submit" value="Upload Files" class="myForm" id="submit_btn"></p>
    </DIV>
    </form>
    
    <iframe src="javascript:false;" name="xupload" style="position:absolute;left:-9999px;"></iframe>
    <script type="text/javascript">
    //Specify your form ID
    var x_form_id = 'myform';
    var x_mode = 1;
    var x_tmpl_name = '';
    </script>
    <script src="xupload.js" type="text/javascript"></script>
    
    </BODY>
    </HTML>


    Perl code rendering the html
    Java Code:
    if(my $verifypage = $g->{CV}{htmlverify}) {
    
    # passing variables
     xxxxx
     .... 
    
    # render the page:
      send_header();
      $p->pf($verifypage);
    }
    [/QUOTE]
    Last edited by camaross; 05-16-2011 at 12:43 AM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,401
    Rep Power
    25

    Default

    What part of this is related to java?

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    JavaScript is to Java as Ham is to Hamster -- similar names, but otherwise unrelated. Your best bet is to Google a JavaScript forum and ask this question there.

  4. #4
    camaross is offline Member
    Join Date
    May 2011
    Posts
    2
    Rep Power
    0

Similar Threads

  1. Replies: 1
    Last Post: 01-02-2011, 07:23 PM
  2. HonoGenerate for Java,jsp,html,javascript,css
    By jaapnap in forum Reviews / Advertising
    Replies: 0
    Last Post: 12-05-2009, 11:56 PM
  3. How to print a HTML/JSP span using javascript?
    By sayan751 in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 09-14-2009, 06:38 AM
  4. [B] How to call Perl script from Java [/B]
    By JavaEmpires in forum Advanced Java
    Replies: 7
    Last Post: 12-19-2008, 03:10 PM
  5. struts html tags vs javascript
    By murali in forum Web Frameworks
    Replies: 0
    Last Post: 12-01-2008, 02:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •