Hi Gurus
What I would like to do is to setup a little form where people can put in a
date (e.g. Day: [....] Month..... [....] Year [......], where ... is user
input) and subsequently, will take them through to an anchor (<A
NAME={date}></A>), relating to the date that they selected. As you may have
worked out by now, I am a real novice when it comes to java script.
I have a browse using Google, but so far no luck
Let me know if you can help
Cheers
Nicolaas 11 1349
"WindAndWaves" <ac****@ngaru.com> wrote in message
news:oT*******************@news.xtra.co.nz... Hi Gurus
What I would like to do is to setup a little form where people can put in
a date (e.g. Day: [....] Month..... [....] Year [......], where ... is user input) and subsequently, will take them through to an anchor (<A NAME={date}></A>), relating to the date that they selected. As you may
have worked out by now, I am a real novice when it comes to java script.
I have a browse using Google, but so far no luck
Let me know if you can help
Cheers
Nicolaas
Instead of a link, how about just going to the page?
Will this get you started? Watch for word-wrap.
<html>
<head>
<title>datelink.htm</title>
<script type="text/javascript">
function ddmmyy() {
var dd = document.getElementById("dd").value;
var mm = document.getElementById("mm").value;
var yy = document.getElementById("yy").value;
var zz = yy + mm + dd;
location.href = zz + ".htm";
}
</script>
</head>
<body>
<form>
Day: <input type="text" name="dd" size="2">
Month: <input type="text" name="mm" size="2">
Year:<input type="text" name="yy" size="4">
<input type="button" value="OK" onclick="ddmmyy()">
</form>
</body>
</html>
McKirahan wrote: "WindAndWaves" <ac****@ngaru.com> wrote in message news:oT*******************@news.xtra.co.nz...
Hi Gurus
What I would like to do is to setup a little form where people can put in a
date (e.g. Day: [....] Month..... [....] Year [......], where ... is user input) and subsequently, will take them through to an anchor (<A NAME={date}></A>), relating to the date that they selected. As you may
have
worked out by now, I am a real novice when it comes to java script.
I have a browse using Google, but so far no luck
Let me know if you can help
Cheers
Nicolaas
Instead of a link, how about just going to the page?
Will this get you started? Watch for word-wrap.
<html> <head> <title>datelink.htm</title> <script type="text/javascript"> function ddmmyy() { var dd = document.getElementById("dd").value;
var dd=document.forms['myForm'].elements['dd'].value;
var mm = document.getElementById("mm").value;
var mm=document.forms['myForm'].elements['mm'].value;
var yy = document.getElementById("yy").value;
var yy=document.forms['myForm'].elements['yy'].value;
Picking up elements via the name attribute while using getElementByID is
an IE-ism that should be avoided. And, the forms collection is more
widely supported.
var zz = yy + mm + dd; location.href = zz + ".htm";
document.location.href = "http://" + yy + mm + dd + ".htm";
return false;
} </script> </head> <body> <form>
<form name="myForm" action="myPage.php" onsubmit="return ddmmyy()">
Where myPage.php is a page that will return a Location Header to the
proper location, in the event JS is disabled.
Day: <input type="text" name="dd" size="2"> Month: <input type="text" name="mm" size="2"> Year:<input type="text" name="yy" size="4"> <input type="button" value="OK" onclick="ddmmyy()">
<input type="submit" value="OK">
</form> </body> </html>
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Thanks for that guys, how do I make the php page? I have absolutely no idea
about that.
"Randy Webb" <Hi************@aol.com> wrote in message
news:8O********************@comcast.com... McKirahan wrote: "WindAndWaves" <ac****@ngaru.com> wrote in message news:oT*******************@news.xtra.co.nz...
Hi Gurus
What I would like to do is to setup a little form where people can put
in a
date (e.g. Day: [....] Month..... [....] Year [......], where ... is
userinput) and subsequently, will take them through to an anchor (<A NAME={date}></A>), relating to the date that they selected. As you may
have
worked out by now, I am a real novice when it comes to java script.
I have a browse using Google, but so far no luck
Let me know if you can help
Cheers
Nicolaas
Instead of a link, how about just going to the page?
Will this get you started? Watch for word-wrap.
<html> <head> <title>datelink.htm</title> <script type="text/javascript"> function ddmmyy() { var dd = document.getElementById("dd").value;
var dd=document.forms['myForm'].elements['dd'].value;
var mm = document.getElementById("mm").value;
var mm=document.forms['myForm'].elements['mm'].value;
var yy = document.getElementById("yy").value;
var yy=document.forms['myForm'].elements['yy'].value;
Picking up elements via the name attribute while using getElementByID is an IE-ism that should be avoided. And, the forms collection is more widely supported.
var zz = yy + mm + dd; location.href = zz + ".htm";
document.location.href = "http://" + yy + mm + dd + ".htm"; return false;
} </script> </head> <body> <form>
<form name="myForm" action="myPage.php" onsubmit="return ddmmyy()">
Where myPage.php is a page that will return a Location Header to the proper location, in the event JS is disabled.
Day: <input type="text" name="dd" size="2"> Month: <input type="text" name="mm" size="2"> Year:<input type="text" name="yy" size="4"> <input type="button" value="OK" onclick="ddmmyy()">
<input type="submit" value="OK">
</form> </body> </html>
-- Randy comp.lang.javascript FAQ - http://jibbering.com/faq
WindAndWaves wrote: Thanks for that guys, how do I make the php page? I have absolutely no idea about that.
You can start by consulting the comp.lang.javascript FAQ with regards to
top-posting and trimming your quotes. As for the PHP, it would depend on
what your server offers. It may offer PHP, ASP, PERL, nothing, or some
other language. Then, you can ask in a related newsgroup about how to
write the proper code to set a Location Header. http://www.php.net/
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
>"Randy Webb" <Hi************@aol.com> wrote in message
news:Ro********************@comcast.com... WindAndWaves wrote:
Thanks for that guys, how do I make the php page? I have absolutely no
idea about that.
You can start by consulting the comp.lang.javascript FAQ with regards to top-posting and trimming your quotes. As for the PHP, it would depend on what your server offers. It may offer PHP, ASP, PERL, nothing, or some other language. Then, you can ask in a related newsgroup about how to write the proper code to set a Location Header.
http://www.php.net/ -- Randy comp.lang.javascript FAQ - http://jibbering.com/faq
Thank you for that answer and I am sorry about my lack of understanding
about the News etiquette. Anyway, i have this so far:
<html>
<head>
<title>datelink.htm</title>
<script type="text/javascript">
function ddmmyy() {
var dd=document.forms['DF'].elements['dd'].value;
var dd=document.forms['DF'].elements['mm'].value;
var dd=document.forms['DF'].elements['yy'].value;
document.location.href = "#" + yy + mm + dd;
return false;
}
</script>
</head>
<body>
<form name="DF" onsubmit="return ddmmyy()">
Day: <input type="text" name="dd" size="2">
Month: <input type="text" name="mm" size="2">
Year:<input type="text" name="yy" size="4">
<input type="submit" value="OK">
</form>
</body>
</html>
But, what happens is that I get the following in the address bar:
blah blah/go.html?dd=31&mm=10&yy=2004
While I would prefer to get go.html#31102004
How would I go about this.
TIA once more. Help is really appreciated.
Kind regards
Nicolaas
WindAndWaves wrote: Anyway, i have this so far:
<html> <head> <title>datelink.htm</title> <script type="text/javascript"> function ddmmyy() { var dd=document.forms['DF'].elements['dd'].value; var dd=document.forms['DF'].elements['mm'].value; var dd=document.forms['DF'].elements['yy'].value; document.location.href = "#" + yy + mm + dd; return false;
} </script> </head> <body> <form name="DF" onsubmit="return ddmmyy()"> Day: <input type="text" name="dd" size="2"> Month: <input type="text" name="mm" size="2"> Year:<input type="text" name="yy" size="4"> <input type="submit" value="OK"> </form> </body> </html>
But, what happens is that I get the following in the address bar: blah blah/go.html?dd=31&mm=10&yy=2004 While I would prefer to get go.html#31102004
You probably copied & forgot to update the var names, I think this is
what you meant to do:
var dd=document.forms['DF'].elements['dd'].value;
var mm=document.forms['DF'].elements['mm'].value;
var yy=document.forms['DF'].elements['yy'].value;
Then build the string:
var loc='go.html'+ "#" + yy + mm + dd;
alert('loc = '+loc);
document.location.href=loc;
Mike
"Randy Webb" <Hi************@aol.com> wrote in message
news:8O********************@comcast.com... document.location.href = "http://" + yy + mm + dd + ".htm";
I don't think that http://20040923.htm will display a page!
Perhaps you meant:
document.location.href = http://{domain}/{path}/ + yy + mm + dd +
".htm";
Otherwise good comments.
McKirahan wrote: "Randy Webb" <Hi************@aol.com> wrote in message news:8O********************@comcast.com...
document.location.href = "http://" + yy + mm + dd + ".htm";
I don't think that http://20040923.htm will display a page!
If I name my domain 20040923.html it might :) But you are correct.
Perhaps you meant:
document.location.href = http://{domain}/{path}/ + yy + mm + dd + ".htm";
Otherwise good comments.
Yeah, its the effects of answering in too big a hurry.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
WindAndWaves wrote:
<--snip--> Thank you for that answer and I am sorry about my lack of understanding about the News etiquette. Anyway, i have this so far:
<html> <head> <title>datelink.htm</title> <script type="text/javascript"> function ddmmyy() { var dd=document.forms['DF'].elements['dd'].value; var dd=document.forms['DF'].elements['mm'].value; var dd=document.forms['DF'].elements['yy'].value; document.location.href = "#" + yy + mm + dd; return false;
} </script> </head> <body> <form name="DF" onsubmit="return ddmmyy()"> Day: <input type="text" name="dd" size="2"> Month: <input type="text" name="mm" size="2"> Year:<input type="text" name="yy" size="4"> <input type="submit" value="OK"> </form> </body> </html>
But, what happens is that I get the following in the address bar:
blah blah/go.html?dd=31&mm=10&yy=2004
The fact that you are even getting that URL is surprising and points to
you testing it in IE only. What it *should* be giving you is
go.html?dd=31&mm=undefined&yy=undefined. But IE is picking up the mm and
yy from the name fields, which it shouldn't. Read the other reply with
regards to your var names and how to correct the URL issue.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
"Randy Webb" <Hi************@aol.com> wrote in message
news:Xt********************@comcast.com... McKirahan wrote:
"Randy Webb" <Hi************@aol.com> wrote in message news:8O********************@comcast.com...
document.location.href = "http://" + yy + mm + dd + ".htm";
I don't think that http://20040923.htm will display a page!
If I name my domain 20040923.html it might :) But you are correct.
Perhaps you meant:
document.location.href = http://{domain}/{path}/ + yy + mm + dd + ".htm";
Otherwise good comments.
Yeah, its the effects of answering in too big a hurry.
-- Randy comp.lang.javascript FAQ - http://jibbering.com/faq
Just another little thank you Randy, you were particularly helpful.
mscir wrote: You probably copied & forgot to update the var names, I think this is what you meant to do:
var dd=document.forms['DF'].elements['dd'].value; var mm=document.forms['DF'].elements['mm'].value; var yy=document.forms['DF'].elements['yy'].value;
Then build the string:
var loc='go.html'+ "#" + yy + mm + dd; alert('loc = '+loc); document.location.href=loc;
He would be better off with
var e = document.forms['DF'].elements;
var dd = e['dd'].value;
var mm = e['mm'].value;
var yy = e['yy'].value;
...
var loc = 'go.html' + "#" + yy + mm + dd;
alert('loc = ' + loc);
location.href = loc;
PointedEars
--
"Where "Life" is a four letter word"
-- sy****@freds.cojones.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lauren Quantrell |
last post by:
Is there a way to create a text file (such as a Windows Notepad file)
by using a trigger on a table? What I want to do is to send a row of
information to a table where the table: tblFileData has...
|
by: Random Person |
last post by:
Does anyone know how to use VBA to relink tables between two MS Access
databases? We have two databases, one with VBA code and the other with
data tables. The tables are referenced by linked...
|
by: Wendy Powley |
last post by:
I have a subform which represents a 1:N relationship with the main
form. I would like to be able to read values from an external file,
fill the subform with the values read & allow the user to...
|
by: doomx |
last post by:
I'm using SQL scripts to create and alter tables in my DB
I want to know if it's possible to fill the description(like in the
Create table UI) using these scripts.
EX:
CREATE TABLE(...
|
by: Daveyk0 |
last post by:
Hello there,
I have a front end database that I have recently made very many changes
to to allow off-line use. I keep copies of the databases on my hard
drive and link to them rather than the...
| |
by: Terry |
last post by:
Hello,
I wonder if anyone can shed light on this problem for me. I have an
Access 97 front end with an SQL 2000 database. There is a Business main
form with an Owner subform and corresponding...
|
by: anshul |
last post by:
Can somebody tell me about state management in asp.net
using Query Strings.
I am just unable to understand this.
Anshul
|
by: DP |
last post by:
hi,
is there a way to send an e-mail to a customer, using ms access?? or some
kind of automated mail merge, so the user only has to review the body, and
click send?
ive got a customer table,...
|
by: osward |
last post by:
Hi everyone,
Background
1. I have a table that consits 400+ rows of data and is growing by day. The table already has paging links at the bottom but I restricted to display rows of data only >=...
|
by: Atli |
last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t.
In situations where your PHP application...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |