0

I made header.jsp and footer.jsp to make dynamic pages. In the accumulated code JavaScript is not running.

<html>
  <head>
    <title>CAN Invoicing</title>
  </head>
  <body>
    <div style="top:10;height:200px;">
      <div style="float:left;">
        <a href="/"><img src="/images/Amazon-CAN-Logo.png" alt="CAN INVOICING"></img></a>
      </div>
      <div style="float:right;top:200px;">
        <img src="/images/logo_csmetrics.gif" alt="Powered By CSBI"><img>
      </div>
    </div>
    <div style="top:200px;">
      <h1>you are authorized login User ::null</h1>
      <script type="text/javascript">
        function doTest()
        {
          alert("hello");
        }
      </script>
      <h2>Session username swasri</h2>
      <a href="/test/"target="_blank">test</a>
      <a href="/upload/" target="_blank">uplaod</a>
      <a href="/uploadS3/" target="_blank">s3</a>
      <a href="/readS3/" target="_blank">downloadS3</a>
    </div>
    <div><p>footer</p></div>
  </body>
</html>

The dynamic part starts from <h2> till footer div. I am using tomcat apache server to run above code. All the jsps are kept inside webapp folder.

I am running above code in tomcat apache webserver.

3
  • If you mean not working by the alert not appearing, you might consider calling doTest() in order to run the function. Commented Jan 18, 2016 at 11:55
  • Where do you call that script? Commented Jan 18, 2016 at 11:58
  • What's with the </img> end tags? Commented Jan 24, 2016 at 15:11

2 Answers 2

1

Try calling the doTest() function, right now it isn't being called.

<script type="text/javascript">
  function doTest() {
     alert("hello");
  }

  doTest();
</script>
Sign up to request clarification or add additional context in comments.

Comments

0

Try calling the doTest() function.

 <html>
 <title>CAN Invoicing</title>
 <head>
 <script type="text/javascript">
        function doTest()
        {
            alert("hello");
        }
    </script>
</head>
<body onload="javascript:doTest();">
<div style="top:10;height:200px;">
<div style="float:left;"><a href="/"><img src="/images/Amazon-CAN-Logo.png" alt="CAN INVOICING"></img></a></div>
<div style="float:right;top:200px;"><img src="/images/logo_csmetrics.gif" alt="Powered By CSBI"><img></div>
</div>          
<div style="top:200px;">
<h1>you are authorized login User ::null</h1>   
<h2>Session username swasri</h2>
<a href="/test/"target="_blank">test</a>
<a href="/upload/" target="_blank">uplaod</a>
<a href="/uploadS3/" target="_blank">s3</a>
<a href="/readS3/" target="_blank">downloadS3</a>
</div>
<div><p>footer</p></div>
</body>
</html>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.