head> <meta http-equiv= "Content-type" content= "text/html"; Charset=utf-8 "> <title>web Service File up&down test</title> <script type=" Text/javascript "src= "Js/jquery-1.7.js" ></script>
The JS code above:
1. $ (function ()) function is used to dynamically modify the value of the selected file;
2, GetUrl () method for form submission, modify the value of the action;
Reproduced in addition:
#########################################
HTML code:
<form id= "Myformid" name= "MyForm" action= "" method= "POST" >
<input type= "hidden" id= "Inparam" name= "Inparam"/>
<input type= "hidden" id= "Tstype" name= "Tstype"/>
<input type= "hidden" id= "Zd" name= "Zd"/>
</form>
A friend familiar with JavaScript must know that JS can dynamically change the value of the action in form forms as follows:
Document.myForm.action = "userinfo.shtml";
Note that the form label must have the name attribute, the light has an ID, no name does not work
document.myform.attributes["Action"].value = "XXXXXXXX";
document.all ("Myformid"). setattribute ("Action", "value of the action to be assigned");
Both of these methods have been tested in JavaScript.
-------
Here's how to set the value of the action in form forms in jquery.
$ ("#myFormId"). attr ("Action", "userinfo.shtml");
"Note": $ ("#myFormId"). action= "XXX"; This kind of writing is not working!
-------------------------------------------------------------------------------------------
<form action= "xxx.php" id= "Demo_form" method= "POST" >
<input type= "text" id= "Form_stock" name= "s" data-default= "code/name/Pinyin" value= ""/>
<input type= "hidden" value= "Addstock" name= "action"/>
<button onclick= "$ (' #demo_form '). attr ({' Action ': ' insert.php '}). Submit ();" > Add </button>
<button onclick= "$ (' #demo_form '). attr ({' Action ': ' search.php '}). Submit ();" > Enquiry </button>
</form>
-------------------------------------------------------------------------------------------
When you use jquery, you can set the following:
Form form:
<form name= "MyForm" id= "MyForm" action= "ssss" "method=" Post "onsubmit=" GetUrl (); " >
JavaScript method:
<script type= "Text/javascript" >
function GetUrl () {
$ (' form '). attr (' action ', ' New_url ');
}
</script>
Or with simple javascript:
function Test1 () {
alert (document.myform.action);//return value: Http://localhost:8080/XXX/ssss
alert ( document.myform.attributes["Action"].value)//return value: SSSs is different from the previous line
// below three lines,
whichever line document.getElementById (' MyForm '). action= ' New_url ';
document.myform.action= ' New_url ';
document.myform.attributes["Action"].value = ' new_url ';
}