How to invoke the JS function in the JSP and get the value in the JSP in JS

Source: Internet
Author: User

1. Code in the JSP:

<script language= "javascript" type= "Text/javascript" src= "Index.js" ></script><body> write this code inside:
<input type= "text" name= "word" id= "wl" ><br><input type= "Submit" name= "Submit" onclick= "Show ()" Value= " Submit ">
2. js in the code:

Function Show () {var test=document.getelementsbyname (' word ') [0].value;var Test1=document.getelementbyid (' wl '). The difference between the two is that one is an object array and one is not an object array;}
3. js to convert a var variable into shaping:
var a = "123"; var B = parseint (a);
4. Display the contents of JS in the JSP page:

document.getElementById (' out '). Value = Test1;

How to invoke the JS function in the JSP and get the value in the JSP in JS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.