Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Navigation Buttons - Previous & Next Button


  • Please log in to reply

#16
carysma

carysma

    Member

  • Topic Starter
  • Member
  • PipPip
  • 14 posts
Sorry :) I hope I didn't bugged you too much.

This is actually my midterm take home reviewer. Online classes is tough. Now I learn, so maybe next semester, I will be taking my classes in campus.

I learn fast when I actually do it. And if I don't know how, I analyze the actual answer that makes it work. So I've been analyzing all the answers you've been giving me. All that work.

Sorry again if I was a pest to you :)

I appreciate all your help. Have a good one!
  • 0

Advertisements


#17
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 31,959 posts
No problem. It's no bother to help you, but it's my experience that people learn better, when they do it themselves and get a pointer in the right direction occasionally.

Let me know when you have linked the function I posted to the radiobuttons and I'll be happy to have a look. :)
  • 0

#18
carysma

carysma

    Member

  • Topic Starter
  • Member
  • PipPip
  • 14 posts
I did good with my Midterm. Although, it still bugging me that I can't resolve the last exercise I was doing. Below is the final code I have . . . and I should say . . . quit on this one. It's tough! I can't get it to work :)

Everything is showing normal except the function is NOT working right. I tried to click one of the radio buttons and try to submit it. BUt it doesn't add a day or two or processing but instead it shows undefined :)

Hmmm :)


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title> Digital Photos </title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<script type="text/javascript">
<!--
var currentTime = new Date();
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()
var pmonth = pickupTime.getMonth() + 1;
var pday = pickupTime.getDate();
var pyear = pickupTime.getFullYear();

function pickupdate(processing) {
var pickupTime = new Date();
var processing = 1;
pickupTime.setDate(currentTime.getDate()+processing);
}

//-->
</script>

</head>

<body>
<h1>Don's Digital Photo Development</h1>
<form action="FormProcessor.html" method="get" enctype="application/x-www-form-urlencoded">
<form id="form1" name="form1" method="post" action="">
<label for="textfield">Last name</label><br />
<input name="Last name" type="text" />
<p><label for="textfield">First name</label><br />
<input name="First name" type="text" />
<p><label for="textfield">Telephone</label><br />
<input name="Telephone" type="text" />
<p><label for="radio">Item</label><br />
<input name="Item" type="radio" value="5x7 Prints(1 day)" />5x7 Prints(1 day)
<input name="Item" type="radio" value="Poster(1 day)" />Poster(1 day)
<input name="Item" type="radio" value="Coffee Mug(2 days)" />Coffee Mug(2 days)
<input name="Item" type="radio" value="T-shirt(2 days)" />T-shirt(2 days)
<p> Today's Date <br />
<script type="text/javascript"> document.write("<input name=date type=text value=" + month + "/" +
day + "/" + year + ">")</script> <br />
Pick-up Date <br />
<script type="text/javascript"> document.write("<input name=date type=text value=" + pmonth + "/" +
pday + "/" + pyear + ">")</script> <br />

<p> <input name="submit" type="submit" value="Place Order" />

</form>
</body>
</html>
  • 0

#19
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 31,959 posts
Hi carysma,

Try this one:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title> Digital Photos </title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<script type="text/javascript">
<!--
var currentTime = new Date();
var month = currentTime.getMonth() + 1
var day = currentTime.getDate()
var year = currentTime.getFullYear()

function pickupdate(processing) {
		 var pickupTime = new Date();
		 pickupTime.setDate(currentTime.getDate()+processing);
		 var pmonth = pickupTime.getMonth() + 1;
		 var pday = pickupTime.getDate();
		 var pyear = pickupTime.getFullYear();
		 oFormObject = document.form1.pupdate;
		 oFormObject.value = pmonth + "/" + pday + "/" + pyear;
}
//-->
</script>

</head>

<body>
<h1>Don's Digital Photo Development</h1>
<form id="form1" name="form1" method="post" action="FormProcessor.html" method="get" enctype="application/x-www-form-urlencoded">
<label for="textfield">Last name</label><br />
<input name="Last name" type="text" />
<p><label for="textfield">First name</label><br />
<input name="First name" type="text" />
<p><label for="textfield">Telephone</label><br />
<input name="Telephone" type="text" />
<p><label for="radio">Item</label><br />
<input name="Item" type="radio" value="5x7 Prints(1 day)" onclick="pickupdate(1)" />5x7 Prints(1 day)
<input name="Item" type="radio" value="Poster(1 day)" onclick="pickupdate(1)" />Poster(1 day)
<input name="Item" type="radio" value="Coffee Mug(2 days)" onclick="pickupdate(2)" />Coffee Mug(2 days)
<input name="Item" type="radio" value="T-shirt(2 days)" onclick="pickupdate(2)" />T-shirt(2 days)
<p> Today's Date <br />
<script type="text/javascript"> document.write("<input name=date type=text value=" + month + "/" +
day + "/" + year + ">")</script> <br />
Pick-up Date <br />
<input name="pupdate" type="text" value=""><br />

<p> <input name="submit" type="submit" value="Place Order" />

</form>
</body>
</html>

The trick is to make the "pupdate" field value depend on the function and call the function when the selected radiobutton changes.
  • 0

#20
carysma

carysma

    Member

  • Topic Starter
  • Member
  • PipPip
  • 14 posts
Hello Metallica!

You are GENIUS!!!

It works great. Except I have to remove the method="post" from the code shown below: (in order for the form to be submitted and posted to the FormProcessor.html.


<form id="form1" name="form1" method="post" action="FormProcessor.html" method="get" enctype="application/x-www-form-urlencoded">


Other than that - - - its all good!!! You don't have any idea how many textpad I used and name all of them Test, LOL!

I always knew I need the onclick button. huh! What a relieve!

I can sleep good now, hahhahahhah!

Thanks a lot for your help! :)
  • 0

#21
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 31,959 posts
My pleasure. :)

I must admit it took me a while before I realized I'd never get it to work with the document write for the pickup date.
  • 0

#22
Kabul

Kabul

    New Member

  • Member
  • Pip
  • 2 posts

I came up with a crude script that does what we wanted.

<!--quoteo--><div class='quotetop'>QUOTE </div><div class='quotemain'><!--quotec--><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR...nsitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title> Concert Ads </title>

<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

<script type="text/javascript">
//<![CDATA[
var images = new Array(5);
images[0] = new Image();
images[1] = new Image();
images[2] = new Image();
images[3] = new Image();
images[4] = new Image();

images[0].src ="townhouse1.jpg" // the 1 needs to be added or the script will fail
images[1].src ="townhouse2.jpg"
images[2].src ="townhouse3.jpg"
images[3].src ="townhouse4.jpg"
images[4].src ="townhouse5.jpg"

function change (y) {
var plaatje=document.getElementById("picture");
var lengte = (plaatje.src).length;
var picurl = (plaatje.src).substring(lengte-14); // 14 is the length of the images name: townhouse#.jpg
if(picurl=="townhouse1.jpg") { x=0; }
if(picurl=="townhouse2.jpg") { x=1; }
if(picurl=="townhouse3.jpg") { x=2; }
if(picurl=="townhouse4.jpg") { x=3; }
if(picurl=="townhouse5.jpg") { x=4; }
if(x==0 && y==-1) { x=4; y=0; } // when the number becomes negative go to 4
else if(x+y>=5) {x=0; y=0; } // when the number gets too big start over at 0
// change the picture
document.getElementById("picture").src = images[x+y].src;
}
//]]>
</script>
</head>
<body>
<p class="b1">Townhouse: <strong>$319,000</strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<a href="javascript<i>:</i>self.close()">Close Window</a></p>
<p><img src="townhouse2.jpg" id="picture" height="250" width="380" alt="Photo of a townhouse" /></p>
<p><a href="#" onclick="change(-1);"><img border="0" SRC="previous_blue.gif"></a>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<a href="#" onclick="change(1);"><img border="0" SRC="next_blue.gif"></a></p>

<p class="b2"><strong>4 bed, 2 bath, 17,33 square feet, .42 acres</strong></p>
</body>
</html><!--QuoteEnd--></div><!--QuoteEEnd-->


  • 0

#23
Kabul

Kabul

    New Member

  • Member
  • Pip
  • 2 posts
hi.
i wanted to use this code, but it gives such a mistake:

on line: document.getElementById("picture").src = images[x+y].src;
images[x+y].src is NULL or is not an object.
how it could be solve?
thanks in advance.
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP