This is my first HTML page:
<!--first.html-->
<html>
<body>
<div data-role="page" data-theme="a" data-url="first" id="first">
<form id="form1" name="form2" action="checking.html">
<input type="text" name="txtFileName" id="txtFileName"/>
<!-- <button onClick="uploadFile();">Upload</button> -->
<input type="hidden" name="hidden1" value="">
<br><input type="submit" value="Send me your name!" onClick="submitform();"><br>
</form>
<script type="text/javascript">
function submitform()
{
document.forms.form1.hidden1.value=1;
alert("i am working");
document.form1.submit();
}
</script>
</div>
</body>
</html>
This is my second HTML page:
<!-- second.html -->
<html>
<head>
</head>
<body>
<h1>Javascript call after page loaded</h1>
<script>
function getQueryVariable2(variable) {
var query = window.location.search.substring(1);
document.write(query);
var vars = query.split("&");
document.write("<br />");
document.write(vars);
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
document.write("<br />txtFileName = " + getQueryVariable2("txtFileName"));
document.write("<br />hid1 = " + getQueryVariable2("hid1"));
</script>
hellllo
</body>
Here I want to display the contents of hidden1 from first.html. Please suggest to me what code I should use for this.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…