...

View Full Version : question ~ please read



digicam
01-04-2004, 05:17 PM
how do i make a confirm box that makes the user go back 1 page into history? therfor, going to the previous page. please help :confused: :confused:

coothead
01-04-2004, 08:16 PM
Hi there digicam,

Here is a Silly example, I have made two pages so that
you may see how it works.

Page one...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta content="mshtml 6.00.2800.1264" name="generator" />
<title>page one</title>
</head>
<body>
<div>
You are here so
<a style ="text-decoration:none;color:#ff0000;"href="page_two.html">
go there
</a>
</div>
</body>
</html>

Page two...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta content="mshtml 6.00.2800.1264" name="generator" />
<title>page two</title>
<script type="text/javascript">
<!--
function question()
{
if(confirm("If you are homesick.... click OK"))
{
history.go(-1);
}
else
{
alert("Not homesick, stay here then")
}
}
//-->
</script>
</head>
<body>
<div>
You have here arrived safely so
<a style ="text-decoration:none;color:#ff0000;"href="#"onclick="question();">
click this
</a>
</div>
</body>
</html>

Page one will take you to page two.
the confirm box will take you back....or not :D

c:cool::cool:thead

digicam
01-04-2004, 08:27 PM
alright. thanks. ill have to test it out.

:thumbsup:

(tested)

thanks for the code. its valid. i appreciate it.
:rolleyes:

Nightfire
01-04-2004, 08:50 PM
Next time read the posting guidelines (http://www.codingforums.com/postguide.htm), especially make note of number 2 :)

digicam
01-04-2004, 09:10 PM
sorry... i was going to do that but the wuestion was too long to put in the field box... :(

digicam
01-04-2004, 09:22 PM
also, i spiced up the code a bit. make sure you name the files: "page_1" and "page_two"

Page one ~

<center>
<b>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta content="mshtml 6.00.2800.1264" name="generator" />
<title>page one</title>
</head>
<body>
<div>
You are at home. If you want to go to school, go
<a style ="text-decoration:none;color:#000000;"href="page_two.html">
here
</a>
</div>
</body>
</html>
</b>
</center>

Page two ~

<center>
<b>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta content="mshtml 6.00.2800.1264" name="generator" />
<title>page two</title>
<script type="text/javascript">
<!--
function question()
{
if(confirm("If you are homesick click OK. If not click Cancel"))
{
history.go(-1);
}
else
{
alert("Not homesick? Stay here then")
}
}
//-->
</script>
</head>
<body>
<div>
Your at school. Are you homesick? If so, go
<a style ="text-decoration:none;color:#000000;"href="#"onclick="question();">
here
</a>
</div>
</body>
</html>

Paul Jr
01-05-2004, 04:31 AM
Originally posted by digicam
also, i spiced up the code a bit
Where...?

Nightfire
01-05-2004, 06:02 AM
He made the code invalid by adding <center><b>Outside the <html> tags :)

Willy Duitt
01-05-2004, 07:02 AM
Hi C:D:Dthead;

Welcome to Coding Forums. :thumbsup:

.....Willy

Edit: You too digicam. :o

coothead
01-05-2004, 08:40 AM
Hi there Willy,

Thanks for the welcome.
It's nice to be here with you :D
Arrived here via your link at the 'City'

c:D:Dthead

Mhtml
01-05-2004, 04:52 PM
This is a javascript question! Please post in the correct forum, and like NightFire said take note of the posting guidelines (http://www.codingforums.com/postguide.htm) ..

digicam
01-06-2004, 07:32 AM
i changed some of the words around. :p



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum