如何傳遞從一個HTML頁面值的JavaScript如何將值形式傳遞給另一個html頁面一個html頁面javascript?
例如另一個html頁面:
Page1.html頁
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>arasu</title>
<style type="text/css">
#popupbox{
margin: 0;
margin-left: 40%;
margin-right: 40%;
margin-top: 50px;
padding-top: 10px;
width: 20%;
height: 150px;
position: absolute;
background: #FBFBF0;
border: solid #000000 2px;
z-index: 9;
font-family: arial;
visibility: hidden;
}
</style>
<script language="JavaScript" type="text/javascript">
function login(showhide){
if(showhide == "show"){
document.getElementById('popupbox').style.visibility="visible";
}else if(showhide == "hide"){
document.getElementById('popupbox').style.visibility="hidden";
}
}
</script>
</head>
<body>
<div >
<form name="login" action="AgaramAnimation.html" method="get">
<center>Username:</center>
<center><input name="username" size="14" /></center>
<center>Password:</center>
<center><input name="password" type="password" size="14" /></center>
<center><input type="submit" name="submit" value="login" /></center>
</form>
</div>
</body>
</html>
這裏我輸入兩個值的用戶名和密碼時,我點擊提交按鈕彈出將關閉和值傳遞給另一頁下面給出的Java腳本。
Page2.html
function gettingvalues()
{
var connection = new ActiveXObject("ADODB.Connection");
var connectionstring = "Data Source="";Initial Catalog="";User ID="";Password="";Provider=""";
connection.Open(connectionstring);
var rs = new ActiveXObject("ADODB.Recordset");
rs.Open("select * from logindetails where username='" **+ username +** "' and password= '" **+ password +** "'", connection);
if (!rs.eof) {
document.getElementById("").innerHTML = ""; }
else {
alert('please enter valid username and password');
}
connection.close;
}
請幫我..........
請舉一些例子。 – Raj 2011-12-18 09:36:51
很難用像jsfiddle這樣的網頁編輯器來製作類似的例子,因爲它需要單獨的html頁面才能工作。 – keithwyland 2013-04-24 23:18:32