473,396 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Dynamic creation of URL

I need a script that will allow a user to enter variables into a form
and then have a script generate a URL based on the input and then go
there.

I have an intranet. The address format is the same, but there are 2
variables in the address that change. Normally the entire address
must be typed in order to change what you want. I'd like to make it
easier by just parsing input from two fields and put them in an
address.

Any help is appreciated.
Jul 20 '05 #1
4 2807
Hi,

paul544 wrote:
I need a script that will allow a user to enter variables into a form
and then have a script generate a URL based on the input and then go
there.

I have an intranet. The address format is the same, but there are 2
variables in the address that change. Normally the entire address
must be typed in order to change what you want. I'd like to make it
easier by just parsing input from two fields and put them in an
address.

Any help is appreciated.


I must assume a few things, because your post is not complete enough.

<FORM NAME="frmValues" ID="frmValues">
<INPUT TYPE="text" NAME="tfValue1" ID="tfValue1">
<BR>
<INPUT TYPE="text" NAME="tfValue2" ID="tfValue2">
</FORM>

javascript:

var strValue1 = document.frmValues.tfValue1.value;
var strValue2 = document.frmValues.tfValue2.value;

var strUrl = "http://www.helloworld.com/" + strValue1
+ "/" + strValue2;

top.location = strUrl;

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #2
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in message news:<3f**********@news.bluewin.ch>...
Hi,

paul544 wrote:
I need a script that will allow a user to enter variables into a form
and then have a script generate a URL based on the input and then go
there.

I have an intranet. The address format is the same, but there are 2
variables in the address that change. Normally the entire address
must be typed in order to change what you want. I'd like to make it
easier by just parsing input from two fields and put them in an
address.

Any help is appreciated.


I must assume a few things, because your post is not complete enough.

<FORM NAME="frmValues" ID="frmValues">
<INPUT TYPE="text" NAME="tfValue1" ID="tfValue1">
<BR>
<INPUT TYPE="text" NAME="tfValue2" ID="tfValue2">
</FORM>

javascript:

var strValue1 = document.frmValues.tfValue1.value;
var strValue2 = document.frmValues.tfValue2.value;

var strUrl = "http://www.helloworld.com/" + strValue1
+ "/" + strValue2;

top.location = strUrl;

HTH,

Laurent


Thanks! Considering how little info I gave, you nailed it. Thanks a bunch.
Jul 20 '05 #3
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in message news:<3f**********@news.bluewin.ch>...
Hi,

paul544 wrote:
I need a script that will allow a user to enter variables into a form
and then have a script generate a URL based on the input and then go
there.

I have an intranet. The address format is the same, but there are 2
variables in the address that change. Normally the entire address
must be typed in order to change what you want. I'd like to make it
easier by just parsing input from two fields and put them in an
address.

Any help is appreciated.


I must assume a few things, because your post is not complete enough.

<FORM NAME="frmValues" ID="frmValues">
<INPUT TYPE="text" NAME="tfValue1" ID="tfValue1">
<BR>
<INPUT TYPE="text" NAME="tfValue2" ID="tfValue2">
</FORM>

javascript:

var strValue1 = document.frmValues.tfValue1.value;
var strValue2 = document.frmValues.tfValue2.value;

var strUrl = "http://www.helloworld.com/" + strValue1
+ "/" + strValue2;

top.location = strUrl;

HTH,

Laurent


Oh, BTW, is there anyway to make the resulting URL launch in a new window?
Thanks again.
Jul 20 '05 #4
Hi,

paul544 wrote:
"Laurent Bugnion, GalaSoft" <galasoft-LB@bluewin_NO_SPAM.ch> wrote in message news:<3f**********@news.bluewin.ch>...
Hi,

paul544 wrote:
I need a script that will allow a user to enter variables into a form
and then have a script generate a URL based on the input and then go
there.

I have an intranet. The address format is the same, but there are 2
variables in the address that change. Normally the entire address
must be typed in order to change what you want. I'd like to make it
easier by just parsing input from two fields and put them in an
address.

Any help is appreciated.


I must assume a few things, because your post is not complete enough.

<FORM NAME="frmValues" ID="frmValues">
<INPUT TYPE="text" NAME="tfValue1" ID="tfValue1">
<BR>
<INPUT TYPE="text" NAME="tfValue2" ID="tfValue2">
</FORM>

javascript:

var strValue1 = document.frmValues.tfValue1.value;
var strValue2 = document.frmValues.tfValue2.value;

var strUrl = "http://www.helloworld.com/" + strValue1
+ "/" + strValue2;

top.location = strUrl;

HTH,

Laurent

Oh, BTW, is there anyway to make the resulting URL launch in a new window?
Thanks again.


That would be something like:

var g_wPopUp = null;

function openPopUp()
{
var strValue1 = document.frmValues.tfValue1.value;
var strValue2 = document.frmValues.tfValue2.value;

var strUrl = "http://www.helloworld.com/" + strValue1
+ "/" + strValue2;

if ( ( g_wPopUp == null )
|| g_wPopUp.closed )
{
var iWidth = WWW;
var iHeight = HHH;
var iLocX = ( screen.width - iWidth ) / 2;
var iLocY = ( screen.height - iHeight ) / 2;
var strFeatures = "width=" + iWidth
+ ",height=" + iHeight
+ ",screenX=" + iLocX
+ ",screenY=" + iLocY
+ ",left=" + iLocX
+ ",top=" + iLocY;

g_wPopUp = open( strUrl, NAME, strFeatures );
}
else
{
g_wPopUp.location = strUrl;
g_wPopUp.focus();
}
}

Don't forget to replace WWW with the desired pop-up width, HHH with its
height and NAME with a unique name.

The function openPopUp could be called ONCLICk of a button in your form,
for example.

It's also nice to close the pop-up when the user leaves the page. This
is done with (in the main window):

<BODY ONUNLOAD="unloadMe();">

and

function unloadMe()
{
if ( ( g_wPopUp != null )
&& !g_wPopUp.closed )
{
g_wPopUp.close();
}
g_wPopUp = null;
}

HTH,

Laurent
--
Laurent Bugnion, GalaSoft
Webdesign, Java, javascript: http://www.galasoft-LB.ch
Private/Malaysia: http://mypage.bluewin.ch/lbugnion
Support children in Calcutta: http://www.calcutta-espoir.ch

Jul 20 '05 #5

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

Similar topics

3
by: Eddie de Bear | last post by:
Hi, A project I am working on has a requirement for dynamic menus. For the most part this works really well. The menus I'm creating a based on files and directories, so naturally the menu...
5
by: Tompa | last post by:
Hi, I would like to create images on the fly as a response to an http request. I can do this with PIL like this (file create_gif.py): from PIL import Image, ImageDraw print 'Status: 200 OK'...
2
by: JC | last post by:
Hello, I'm looking for examples of how to make dynamic creation of code and dynamic execution of the same code. I want to do some code dynamically and then I want to use it to get some results....
1
by: andrew queisser | last post by:
I've been trying to dynamically create a class DevT that's derived from a generic base GenBase<T>. It doesn't seem to work. I'm attaching a code sample below that illustrates the problem. ...
2
by: charliewest | last post by:
I need to create textboxes in real-time, the actual number of which is determine by a result from a database query. I have been able to create the controls, and then add them to the ASPX page....
2
by: Dave Williamson | last post by:
When a ASPX page is created with dynamic controls based on what the user is doing the programmer must recreate the dynamic controls again on PostBack in the Page_Load so that it's events are wired...
15
by: rwf_20 | last post by:
I just wanted to throw this up here in case anyone smarter than me has a suggestion/workaround: Problem: I have a classic producer/consumer system which accepts 'commands' from a socket and...
0
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab,...
13
by: rn5a | last post by:
In a shopping cart app, suppose a user has placed 5 orders, I want to show him 5 LinkButtons (one for each order) so that when he clicks the first LinkButton, he would be shown the details of his...
1
by: cdmsenthil | last post by:
I have an Infragistics UltrawebGrid . Each Row in the grid is attached to a context menu using Infragistics CSOM Upon click on the menu, I am creating an Iframe dynamically which points to...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
agi2029
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 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.