473,549 Members | 2,627 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2818
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.frmVal ues.tfValue1.va lue;
var strValue2 = document.frmVal ues.tfValue2.va lue;

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_S PAM.ch> wrote in message news:<3f******* ***@news.bluewi n.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.frmVal ues.tfValue1.va lue;
var strValue2 = document.frmVal ues.tfValue2.va lue;

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_S PAM.ch> wrote in message news:<3f******* ***@news.bluewi n.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.frmVal ues.tfValue1.va lue;
var strValue2 = document.frmVal ues.tfValue2.va lue;

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_S PAM.ch> wrote in message news:<3f******* ***@news.bluewi n.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.frmVal ues.tfValue1.va lue;
var strValue2 = document.frmVal ues.tfValue2.va lue;

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

top.locatio n = 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.frmVal ues.tfValue1.va lue;
var strValue2 = document.frmVal ues.tfValue2.va lue;

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.locati on = 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="unloa dMe();">

and

function unloadMe()
{
if ( ( g_wPopUp != null )
&& !g_wPopUp.close d )
{
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
4757
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 creation takes some time. The approach I took was to override the OnSelect method of the MenuItem class, which had code to populate the
5
4376
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' print 'Content-type: text/html' print print '<HTML><HEAD><TITLE>Python Dynamic Image Creation Test</TITLE></HEAD>'
2
2053
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. Then I want to store the C# code in a database. I found an example explaining how to do a sum of 100 numbers. What I didn't understand was the way...
1
2129
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. CreateType() fails when the base class is a parametrized class, as in DevT : GenBase<int>. CreateType() works if the base class is not parametrized, even...
2
16237
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. However, when i submit the page, i am unable to read the values entered in these new textboxes. I have first tried to use ...
2
2544
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 and are called like a static control. Here is the problem that I need to solve. The processing overhead that occurs to determine what dynamic...
15
3024
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 'executes' them. Obviously, each different command (there are ~20 currently) has its own needed functionality. The dream goal here would be to...
0
2059
by: Pascal Costanza | last post by:
Dynamic Languages Day @ Vrije Universiteit Brussel ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Monday, February 13, 2006, VUB Campus Etterbeek The VUB (Programming Technology Lab, System and Software Engineering Lab), ULB (deComp) and the Belgian Association for Dynamic Languages (BADL) are very pleased to invite you to a whole...
13
10149
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 first order. Likewise if he clicks the second LinkButton, he will be shown the details of the second order he had placed. The Text of the LinkButtons...
1
4880
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 another page in the same domain which also contains infragistics datagid populated with default data retrieved from Data Base. After creating the frame I...
0
7720
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. ...
0
7959
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...
1
7473
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...
0
7810
tracyyun
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6044
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.