472,374 Members | 1,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Location.replace - form

JHB
Hi,

How can I do a location.replace when I use a form, like when I use a href?

This works.
<a href="Ny HTML-side20.htm"; method="post" id="frm" name="BrugerHovedSide"
onsubmit="location.replace(this.href);" >
<input class="ok" type="submit" value="Opfrisk data" id=submit1
name=submit1>
</a>

this dosen't work
<form action="Ny HTML-side20.htm"; method="post" id="frm"
name="BrugerHovedSide" onsubmit="location.replace(this.href);" >
<input class="ok" type="submit" value="Opfrisk data" id=submit1
name=submit1>
</form>
TIA
Jųrn
HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<a href="Ny HTML-side20.htm"; method="post" id="frm" name="BrugerHovedSide"
onsubmit="location.replace(this.href);" >
<input class="ok" type="submit" value="Opfrisk data" id=submit1
name=submit1>
</a>

<form action="Ny HTML-side20.htm"; method="post" id="frm"
name="BrugerHovedSide" onsubmit="location.replace(this.href);" >
<input class="ok" type="submit" value="Opfrisk data" id=submit1
name=submit1>
</form>

</BODY>
</HTML>
Jul 23 '05 #1
2 8435
JHB wrote on 15 jul 2005 in comp.lang.javascript:

[Please do not send html on usenet, this is not email]
How can I do a location.replace when I use a form, like when I use a
href?
You cannot really.
This works.
Not really
<a href="Ny HTML-side20.htm"; method="post" id="frm"
The ; has no function here, it is wrong html.
method="post" has no function in <a >
name="BrugerHovedSide" onsubmit="location.replace(this.href);" >
<input class="ok" type="submit" value="Opfrisk data" id=submit1
name=submit1>
</a>
onsubmit does not have a function in <a >
you need a <form > for onsubmit

try for <a >:

onclick="location.replace(this.href);return false;"
preventing the href executing while javascript is active in a browser.
this dosen't work
Doesn't it?
<form action="Ny HTML-side20.htm"; method="post" id="frm"
name="BrugerHovedSide" onsubmit="location.replace(this.href);" >
The ; has no function here.

The onsubmit should have a return false;
see above, same syntax as onclick

However the onsubmit false will not execute the form, so no <input >
values will be sent.
<input class="ok" type="submit" value="Opfrisk data" id=submit1
name=submit1>
</form>


Conclusion:

1 For sending form input data the form has to go to the action="" page by
that way.

2 Onsubmit can only be used to prevent execution of the <form> otr to do
some local actions or both.

try:

<form action='' method='post'
onsubmit ='return confirm("Really send this?")'>
<input name='data' value='myValue'>
<input type='submit'>
</form>

This will only execute the form and the data value
if confirm() returns true after clicking it's 'Yes' button/
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)

Jul 23 '05 #2

I gather you mean, loading a url using .replace() by using a form element:

<form onsubmit="return false">
<input type="button" onclick="location.replace(URLGOESHERE)">
</form>

Danny
On Fri, 15 Jul 2005 10:51:05 -0700, JHB <joern_bea@removeThis_tdcadsl.dk>
wrote:

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Jul 23 '05 #3

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

Similar topics

2
by: James Marshall | last post by:
I'm trying to override location.replace() but I can't. I can override window.open(), document.write(), and other built-in methods, but not location.replace(). Here's a demo that overrides two...
5
by: spam_me_ not | last post by:
I already understand that one cannot disable a browser's forward and back functions. This is a situation where I have code working in Mozilla V1.6 and would like something similar for Opera and...
13
by: Will Pittenger | last post by:
I have a Control derived class. When the parent of the control changes the control's Location property, the stack overflows. I have not found a way to find out what was on the stack when it does...
3
by: Al | last post by:
Hi all... I have created an aspx page that contains an animated GIF. I am using javascript and location.replace to redirect from this page to another aspx page which takes several seconds to...
9
by: Jean Pierre Daviau | last post by:
Hi everybody, I have this function in a page (namely cours.html) function go(inValue) { var lien = 'file:///F:/MyWebs/jeanpierredaviaucom/httpdocs/cours1.html?T1=' + document.R.T1.value;
12
by: Jack | last post by:
Since, I have not got some desired advise, I am reposting this for some asnwer/valuable suggestion. Thanks. THE FOLLOWING IS A PART OF CODE FROM A ASP PAGE <% sql01 = "SELECT COUNT(*) AS...
13
by: John Smith | last post by:
I am using IE 6.0 from http://www.javaworld.com/javaworld/jw-07-1996/jw-07-javascript-p2.html I gather that "If you need to test a number of command lines, you can reduce the keystrokes by...
5
by: Alan Little | last post by:
Do a search at this site: http://www.mindsift.com/ Select a non-sponsored link, then give the site a rating. The rating frame closes. Now click your "back" button. If you're using IE, you'll...
13
by: Marc | last post by:
The first part of the below writes the name and location of all buttons on a from to a text file. The second part reads that information back in and recreates the buttons. My problem is reading...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
by: F22F35 | last post by:
I am a newbie to Access (most programming for that matter). I need help in creating an Access database that keeps the history of each user in a database. For example, a user might have lesson 1 sent...

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.