elwell
08-07-2003, 10:51 PM
I have this thing for login with passwords and stuff but an error message says: "Object does'nt support this property and method"
<html><head><title>Dow Jon®</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function slide() {
document.getElementById('mover').style.pixelLeft += 5
if (document.getElementById('mover').style.pixelLeft < 301) {
setTimeout("slide()" ,10)
}
else {
document.circlething.src="wordedcircle.gif"
document.getElementById('my_ID').src="C:\im.wav"
}
}
function swap(this_pic) {
document.circlething.src=this_pic
}
function swapback() {
document.circlething.src="wordedcircle.gif"
}
function Login(){
var done=0;
var username=document.getElementById('username').value;
username=username.toLowerCase();
var password=document.getElementById('password').value;
password=password.toLowerCase();
if (username=="jon" && password=="nothingyet") { window.location="current.html"; done=1; }
if (username=="chris" && password=="nothingyet") { window.location="current.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
</script>
<style type="text/css">
<!--
body {
scrollbar-face-color: #0000AA;
}
a {text-decoration: none; color: darkblue}
a:hover {background-color: darkblue; color: white}
#mover {position: absolute; top:216px; left:1px; z-index:30}
#rightfore {position: absolute; top:200px; left:260px; z-index:20}
//nj injin-->
</style>
</head>
<body OnLoad="slide()">
<bgsound id="my_id">
<span style="position: absolute; top:30px; left:40px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('about.gif')" onMouseOut="swapback()" href="about.html">About</a></span>
<span style="position: absolute; top:30px; left:200px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('current.gif')" onMouseOut="swapback()" href="current.html">Current Stocks</a></span>
<span style="position: absolute; top:30px; left:450px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('faq.gif')" onMouseOut="swapback()" href="faq.html">FAQ</a></span>
<span style="position: absolute; top:30px; left:600px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('contact.gif')" onMouseOut="swapback()" href="contact.html">Contact Us</a></span>
<span style="position: absolute; top:100px; left:233px; font-family: Trebuchet MS, sans-serif; color:black; font-size: 72; z-index:30">Dow Jon</span>
<div id="rightfore">
<img src="blackcircle.gif" />
</div>
<div id="mover">
<img name="circlething" id="circlething" src="blankcircle.gif" />
</div>
<span style="position: absolute; top:300px; left:600px; font-family: Trebuchet MS, sans-serif; font-size: 12"><form name="login">Login:     <input name="username" type="textbox" size="10" maxlength="12" /><br />Password:<input name="password" type="password" size="10" maxlength="12" /><input type="button" value="Login" onClick="login()" /></form></span>
</body>
</html>
ALSO:
I want to be able to use cookies but i don't get it much. I have "Javascript For The World Wide Web 4th Edition" and I followed what it said to do exactly but and error message said:
expected ";"
and
userName undefined
and
setCookie() undefined
Here is what my book says
<html><head><title>Cookies!</title>
<script type="text/javascript">
<!-- Hide script from older browsers
expireDate = New Date
expireDate.setMonth(expireDate.getMonth()+9)
userName = "";
if (document.cookie != "") {
userName = document.cookie.split("=")[1]
}
function setCookie() {
userName = document.myForm.nameField.value
document.cookie = "userName=" +userName+";expires=" +expireDate.toGMTString();
}
// End hiding script -->
</script>
</head>
<body onLoad="document.myForm.nameField.value = userName">
<form name="myForm">
Enter Your Name:<input type="text" name="nameField" onBlur="setCookie()">
</form>
</body>
</html>
I would really appreciate any answers.
<html><head><title>Dow Jon®</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function slide() {
document.getElementById('mover').style.pixelLeft += 5
if (document.getElementById('mover').style.pixelLeft < 301) {
setTimeout("slide()" ,10)
}
else {
document.circlething.src="wordedcircle.gif"
document.getElementById('my_ID').src="C:\im.wav"
}
}
function swap(this_pic) {
document.circlething.src=this_pic
}
function swapback() {
document.circlething.src="wordedcircle.gif"
}
function Login(){
var done=0;
var username=document.getElementById('username').value;
username=username.toLowerCase();
var password=document.getElementById('password').value;
password=password.toLowerCase();
if (username=="jon" && password=="nothingyet") { window.location="current.html"; done=1; }
if (username=="chris" && password=="nothingyet") { window.location="current.html"; done=1; }
if (done==0) { alert("Invalid login!"); }
}
// End -->
</script>
<style type="text/css">
<!--
body {
scrollbar-face-color: #0000AA;
}
a {text-decoration: none; color: darkblue}
a:hover {background-color: darkblue; color: white}
#mover {position: absolute; top:216px; left:1px; z-index:30}
#rightfore {position: absolute; top:200px; left:260px; z-index:20}
//nj injin-->
</style>
</head>
<body OnLoad="slide()">
<bgsound id="my_id">
<span style="position: absolute; top:30px; left:40px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('about.gif')" onMouseOut="swapback()" href="about.html">About</a></span>
<span style="position: absolute; top:30px; left:200px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('current.gif')" onMouseOut="swapback()" href="current.html">Current Stocks</a></span>
<span style="position: absolute; top:30px; left:450px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('faq.gif')" onMouseOut="swapback()" href="faq.html">FAQ</a></span>
<span style="position: absolute; top:30px; left:600px; font-family: Trebuchet MS, sans-serif; font-size: 20"><a onMouseOver="swap('contact.gif')" onMouseOut="swapback()" href="contact.html">Contact Us</a></span>
<span style="position: absolute; top:100px; left:233px; font-family: Trebuchet MS, sans-serif; color:black; font-size: 72; z-index:30">Dow Jon</span>
<div id="rightfore">
<img src="blackcircle.gif" />
</div>
<div id="mover">
<img name="circlething" id="circlething" src="blankcircle.gif" />
</div>
<span style="position: absolute; top:300px; left:600px; font-family: Trebuchet MS, sans-serif; font-size: 12"><form name="login">Login:     <input name="username" type="textbox" size="10" maxlength="12" /><br />Password:<input name="password" type="password" size="10" maxlength="12" /><input type="button" value="Login" onClick="login()" /></form></span>
</body>
</html>
ALSO:
I want to be able to use cookies but i don't get it much. I have "Javascript For The World Wide Web 4th Edition" and I followed what it said to do exactly but and error message said:
expected ";"
and
userName undefined
and
setCookie() undefined
Here is what my book says
<html><head><title>Cookies!</title>
<script type="text/javascript">
<!-- Hide script from older browsers
expireDate = New Date
expireDate.setMonth(expireDate.getMonth()+9)
userName = "";
if (document.cookie != "") {
userName = document.cookie.split("=")[1]
}
function setCookie() {
userName = document.myForm.nameField.value
document.cookie = "userName=" +userName+";expires=" +expireDate.toGMTString();
}
// End hiding script -->
</script>
</head>
<body onLoad="document.myForm.nameField.value = userName">
<form name="myForm">
Enter Your Name:<input type="text" name="nameField" onBlur="setCookie()">
</form>
</body>
</html>
I would really appreciate any answers.