473,796 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using a user field to create a link

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
Jul 23 '05 #1
11 1375
"WindAndWav es" <ac****@ngaru.c om> wrote in message
news:oT******** ***********@new s.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.getEle mentById("dd"). value;
var mm = document.getEle mentById("mm"). value;
var yy = document.getEle mentById("yy"). value;
var zz = yy + mm + dd;
location.href = zz + ".htm";
}
</script>
</head>
<body>
<form>
Day: <input type="text" name="dd" size="2"> &nbsp;
Month: <input type="text" name="mm" size="2"> &nbsp;
Year:<input type="text" name="yy" size="4"> &nbsp;
<input type="button" value="OK" onclick="ddmmyy ()">
</form>
</body>
</html>
Jul 23 '05 #2
McKirahan wrote:
"WindAndWav es" <ac****@ngaru.c om> wrote in message
news:oT******** ***********@new s.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.getEle mentById("dd"). value;


var dd=document.for ms['myForm'].elements['dd'].value;
var mm = document.getEle mentById("mm"). value;
var mm=document.for ms['myForm'].elements['mm'].value;
var yy = document.getEle mentById("yy"). value;
var yy=document.for ms['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.locati on.href = "http://" + yy + mm + dd + ".htm";
return false;
}
</script>
</head>
<body>
<form>
<form name="myForm" action="myPage. php" onsubmit="retur n 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"> &nbsp;
Month: <input type="text" name="mm" size="2"> &nbsp;
Year:<input type="text" name="yy" size="4"> &nbsp;
<input type="button" value="OK" onclick="ddmmyy ()">
<input type="submit" value="OK">
</form>
</body>
</html>

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #3
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******** ************@co mcast.com...
McKirahan wrote:
"WindAndWav es" <ac****@ngaru.c om> wrote in message
news:oT******** ***********@new s.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.getEle mentById("dd"). value;


var dd=document.for ms['myForm'].elements['dd'].value;
var mm = document.getEle mentById("mm"). value;


var mm=document.for ms['myForm'].elements['mm'].value;
var yy = document.getEle mentById("yy"). value;


var yy=document.for ms['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.locati on.href = "http://" + yy + mm + dd + ".htm";
return false;
}
</script>
</head>
<body>
<form>


<form name="myForm" action="myPage. php" onsubmit="retur n 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"> &nbsp;
Month: <input type="text" name="mm" size="2"> &nbsp;
Year:<input type="text" name="yy" size="4"> &nbsp;
<input type="button" value="OK" onclick="ddmmyy ()">


<input type="submit" value="OK">
</form>
</body>
</html>

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq

Jul 23 '05 #4
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.javas cript 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.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #5
>"Randy Webb" <Hi************ @aol.com> wrote in message
news:Ro******** ************@co mcast.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.javas cript 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.javas cript 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.for ms['DF'].elements['dd'].value;
var dd=document.for ms['DF'].elements['mm'].value;
var dd=document.for ms['DF'].elements['yy'].value;
document.locati on.href = "#" + yy + mm + dd;
return false;

}
</script>
</head>
<body>
<form name="DF" onsubmit="retur n ddmmyy()">
Day: <input type="text" name="dd" size="2"> &nbsp;
Month: <input type="text" name="mm" size="2"> &nbsp;
Year:<input type="text" name="yy" size="4"> &nbsp;
<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&m m=10&yy=2004

While I would prefer to get go.html#3110200 4

How would I go about this.

TIA once more. Help is really appreciated.

Kind regards

Nicolaas
Jul 23 '05 #6
WindAndWaves wrote:
Anyway, i have this so far:


<html>
<head>
<title>datelink .htm</title>
<script type="text/javascript">
function ddmmyy() {
var dd=document.for ms['DF'].elements['dd'].value;
var dd=document.for ms['DF'].elements['mm'].value;
var dd=document.for ms['DF'].elements['yy'].value;
document.locati on.href = "#" + yy + mm + dd;
return false;

}
</script>
</head>
<body>
<form name="DF" onsubmit="retur n ddmmyy()">
Day: <input type="text" name="dd" size="2"> &nbsp;
Month: <input type="text" name="mm" size="2"> &nbsp;
Year:<input type="text" name="yy" size="4"> &nbsp;
<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&m m=10&yy=2004
While I would prefer to get go.html#3110200 4

You probably copied & forgot to update the var names, I think this is
what you meant to do:

var dd=document.for ms['DF'].elements['dd'].value;
var mm=document.for ms['DF'].elements['mm'].value;
var yy=document.for ms['DF'].elements['yy'].value;

Then build the string:

var loc='go.html'+ "#" + yy + mm + dd;
alert('loc = '+loc);
document.locati on.href=loc;

Mike
Jul 23 '05 #7
"Randy Webb" <Hi************ @aol.com> wrote in message
news:8O******** ************@co mcast.com...
document.locati on.href = "http://" + yy + mm + dd + ".htm";


I don't think that http://20040923.htm will display a page!

Perhaps you meant:

document.locati on.href = http://{domain}/{path}/ + yy + mm + dd +
".htm";

Otherwise good comments.
Jul 23 '05 #8
McKirahan wrote:
"Randy Webb" <Hi************ @aol.com> wrote in message
news:8O******** ************@co mcast.com...

document.loca tion.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.locati on.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.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #9
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.for ms['DF'].elements['dd'].value;
var dd=document.for ms['DF'].elements['mm'].value;
var dd=document.for ms['DF'].elements['yy'].value;
document.locati on.href = "#" + yy + mm + dd;
return false;

}
</script>
</head>
<body>
<form name="DF" onsubmit="retur n ddmmyy()">
Day: <input type="text" name="dd" size="2"> &nbsp;
Month: <input type="text" name="mm" size="2"> &nbsp;
Year:<input type="text" name="yy" size="4"> &nbsp;
<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&m m=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&m m=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.javas cript FAQ - http://jibbering.com/faq
Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
11236
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 only one column: txtOutput I want to use the DB front end (MS Access) to send the text string to the SQL backend, then have the SQL Server create a file to a path, such as F:/myfiledate.txt that holds the text in txtOutput, then the trigger...
3
24039
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 tables in the database where the code resides. If we move the database with the data tables to a new directory, the links are no longer valid. I tried to update the links by changing the Connect property and refreshing: Set td = db.TableDefs(0)...
6
9858
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 view/edit the values via the subform. I thought this would be accomplished using a simple loop; read values, assign the various fields of the subform & repeat for each row of the subform. Seems this is not possible, or at least I have been unable...
8
3995
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( Pk_myPrimaryKey INTEGER CONSTRAINT pk PRIMARY KEY DESCRIPTION 'This is the primary key of the table',
1
4010
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 live databases on the network. Is there a way, via code, when I get back in-house from being on the road to click a button, and select the backends I want to link to? I would want to delete all the current links and link to the "live"
2
3106
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 tables of the same names. A third table BusinessRel records the BusinessID (linked to Business table) and OwnerID (linked to Owner table). This is what happens when the Business main form is loaded. I enter the BusinessID and other stuff, then as...
1
3343
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
17
8798
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, with a field called email address, where the customer can have an e mail address. is there a way to make access create one, using outlook express, or anything
1
2625
osward
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 >= current date. Otherwise, user have to waste time to page up the pages to find the current date 2. I got a script of simple calendar from the web that use mktime() to create links on the calendar Task I need to let user view data earlier than...
221
367757
Atli
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 needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
0
9680
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10230
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10174
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7548
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.