473,809 Members | 2,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Redirect to open specified page

Hi all,

I have a small classifieds site and I use the following script to open the
specific ads in a FRAME - "Enter Ad Number".

I have since done away with the frames and the script now has problems.

What I want to do is change it so that it will open in the current window -
and not a FRAME.

Is there a quick fix for this?

<script language="JavaS cript">

function AdJump()
{
var vPage;
vPage = document.adjump .adnum.value;
vPage = http://www.anypage.com/photoads/ads + vPage + ".html";
document.open() ;
document.locati on.href = vPage;
document.close( );

}

</script>
<CENTER>
<FORM NAME="adjump" OnSubmit="AdJum p()">
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0>
<TR><TD WIDTH=10%> &nbsp; </TD>
<TD WIDTH=90% align="center">
<INPUT TYPE="Text" SIZE=3 VALUE="" NAME="adnum"><B R>
Enter Ad Number</FONT>
</TD></TR>
<TR><TD WIDTH=10%> &nbsp; </TD>
<TD WIDTH=90% align="center">
<INPUT TYPE="Submit" VALUE="Submit">
<INPUT TYPE="Reset" VALUE="Reset">
</TD></TR>
</TABLE>
</FORM>
</CENTER>
Jul 23 '05 #1
7 1564


--
--D. McKirahan
DM********@comc ast.net
"Von Aras" <te***@ikeras.c om> wrote in message
news:qe******** ************@co mcast.com...
Hi all,

I have a small classifieds site and I use the following script to open the
specific ads in a FRAME - "Enter Ad Number".

I have since done away with the frames and the script now has problems.

What I want to do is change it so that it will open in the current window - and not a FRAME.

Is there a quick fix for this?

<script language="JavaS cript">

function AdJump()
{
var vPage;
vPage = document.adjump .adnum.value;
vPage = http://www.anypage.com/photoads/ads + vPage + ".html";
document.open() ;
document.locati on.href = vPage;
document.close( );

}

</script>
<CENTER>
<FORM NAME="adjump" OnSubmit="AdJum p()">
<TABLE WIDTH=100% CELLPADDING=0 CELLSPACING=0>
<TR><TD WIDTH=10%> &nbsp; </TD>
<TD WIDTH=90% align="center">
<INPUT TYPE="Text" SIZE=3 VALUE="" NAME="adnum"><B R>
Enter Ad Number</FONT>
</TD></TR>
<TR><TD WIDTH=10%> &nbsp; </TD>
<TD WIDTH=90% align="center">
<INPUT TYPE="Submit" VALUE="Submit">
<INPUT TYPE="Reset" VALUE="Reset">
</TD></TR>
</TABLE>
</FORM>
</CENTER>


What does "... now has problems" mean?

What you have works for me but I'd change it slightly; watch for word-wrap.

<script type="text/javascript">
function AdJump()
{
var aPage = "http://www.anypage.com/photoads/ads";
var vPage = document.adjump .adnum.value;
location.href = aPage + vPage + ".html";
}
</script>
Jul 23 '05 #2
> What does "... now has problems" mean?
What you have works for me but I'd change it slightly; watch for word-wrap. <script type="text/javascript"> function AdJump() { var aPage = "http://www.anypage.com/photoads/ads"; var vPage = document.adjump .adnum.value; location.href = aPage + vPage + ".html"; } </script>


Thanks Mckirahan,

Because my script was designed for a FRAME - it opens the new page AND THEN
changes to the selected page - leaving an annoying blank page in between the
old and the new page (when not used in a frame).

I can't get it to do anything exactly the way you wrote the changes - but I
will keep playing around with it.

Thanks for the suggestion and the quick answer.

-Von
Jul 23 '05 #3
I actually found a simpler way to do it:
<script type="text/javascript">
function AdJump()
{
window.location .href = http://www.anysite.com/ads/ +
document.getEle mentById("adnum ").value + ".html";

}
</script>

</head>

<body>

<p><input id="adnum" type="text" value size="04"><br>
<button onclick="AdJump ()">Enter Ad Number</button><br>
</p>

</body>
Thanks :)
Jul 23 '05 #4
Hmmm.

I just noticed that the submit button doesn't highlight with 'button
onclick' - and you have to manually click the Submit button instead of just
hitting ENTER.

Please disregard my premature jumping-for-joy!

Anyone have any ideas?

Here is the script again:
<script type="text/javascript">
function AdJump()
{
window.location .href = http://www.anysite.com/ads/ +
document.getEle mentById("adnum ").value + ".html";

}
</script>
</head>

<body>

<p>
<input id="adnum" type="text" value size="04"><br>
<button onclick="AdJump ()">Enter Ad Number</button><br>
</p>

</body>
Jul 23 '05 #5
"Von Aras" <te***@ikeras.c om> wrote in message
news:R9******** ************@co mcast.com...
Hmmm.

I just noticed that the submit button doesn't highlight with 'button
onclick' - and you have to manually click the Submit button instead of just hitting ENTER.

Please disregard my premature jumping-for-joy!

Anyone have any ideas?

Here is the script again:
<script type="text/javascript">
function AdJump()
{
window.location .href = http://www.anysite.com/ads/ +
document.getEle mentById("adnum ").value + ".html";

}
</script>
</head>

<body>

<p>
<input id="adnum" type="text" value size="04"><br>
<button onclick="AdJump ()">Enter Ad Number</button><br>
</p>

</body>


Perhaps this variation is what you want?:

<html>
<head>
<script type="text/javascript">
function AdJump() {
var form = document.forms[0];
if (form.adnum.val ue == "") return false;
form.action = form.action.rep lace(/#/,form.adnum.val ue);
return true;
}
</script>
</head>
<body>
<p>
<form action="http://www.anysite.com/ads/#.html"
method="post" onsubmit="retur n AdJump()">
Enter Ad Number:
<input id="adnum" type="text" value size="4" maxlength="4">
<input type="submit" value="Submit">
</form>
</p>
</body>
</html>

Jul 23 '05 #6
Your code brings back a correct URL - but it doesn't actually work.

I get a 'HTTP 405' error - 'Resource not allowed'.

But if I click the "Go" button again - it works - with the same URL that was
previously generated.

Very strange. :(
Jul 23 '05 #7
"Von Aras" <te***@ikeras.c om> wrote in message
news:gP******** ************@co mcast.com...
Your code brings back a correct URL - but it doesn't actually work.

I get a 'HTTP 405' error - 'Resource not allowed'.

But if I click the "Go" button again - it works - with the same URL that was previously generated.

Very strange. :(

Try this
<input name="adnum" type="text" size="4" maxlength="4">

instead of
<input id="adnum" type="text" value size="4" maxlength="4">
Jul 23 '05 #8

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

Similar topics

1
1828
by: Krechting | last post by:
Hi All, I need a button on my form that opens a new window. I put in a submit button but it always returns to my first page. And then my first page is empty. What button do I need to go to another page (weapon_related)? This is what I use at the moment: 'NewRecord1 Operation Method @3-0C905987
3
1877
by: Hans | last post by:
Hi there, I have a number of domain names and they all point to the same IP address. I would like to redirect to a specific folder, based on the domain name used to access the site. For example. www.root.com - points to the main default page. www.otherroot.com would need to use the default page in a specified folder. My ISP is not able to help here by allocating new IP addresses to the subfolders of the main site. Something to do with...
6
12182
by: lukeo | last post by:
I'm shelling out to an .asp (or htm) page from an application. I want to show this in a window without the address bar, etc... Is there a way I can redirect this page using javascript to a page where I can set the window height, statusbar=no, etc? Thanks, -Luke
3
818
by: Sehboo | last post by:
On my ASP page, when I click a button, I want to do three things: 1. Check for some values. 2. Open a new window and pass some values as query string. 3. Redirect to some other page Here is the code: If (sServiceCenter = "*ALL") Then sServiceCenter = "%"
6
1227
by: Joe | last post by:
Hi, I have a MS Access DB in which a record has just too many fields to be able to allow users to do inline editing in a datagrid. So I want to display as First Name: Text box where first name is displayed and can be edited. Last Name: Text box where last name is displayed and can be edited. At the end of this list, I want to have two buttons, update and cancel.
2
1462
by: John | last post by:
Hi all, After one of my user controls does either a server.transfer or response.redirect, the action method in a my resulting html form is being set and any request variables changed at the client are not being reflected upon posting. How can I get rid of this? Can I somehow programmtically clear the action method so by the time the html reaches the client, it's clear? Please help - quite urgent.
16
3154
by: whyyyy | last post by:
The script below works fine if the form is filled out and submitted. But a (blank) e-mail is sent whenever the page loads, even when the form is not submitted. I would like to receive the e-mail only when the form is submitted <%@LANGUAGE="VBSCRIPT"%> <% Set MyMail=CreateObject("CDO.Message")
3
2740
by: =?Utf-8?B?UGF0UA==?= | last post by:
We have a site that gets many requests for nonexistent pages, files and folders. We want those requests redirected to the index page. However, for static files (i.e. images and some other extensions) we do not want to redirect and in that case want to return nothing. We had been using the 404 error page to redirect but need to discriminate the type of file being requested so that we do not return a page when an image is required. We'd...
0
10376
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
10378
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,...
0
10115
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7653
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
5550
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
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
3861
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.