Looking to do something pretty simple... I have a cancel button on my page.
When the user clicks it, i want to verify they want to cancel and if so,
redirect them.
Code:
-------------------------------------------------------------
<html>
<script language=vbscri pt>
if MsgBox("Testing ",4) = 6 Then
window.location = "http://www.google.com"
End if
</script>
</html>
--------------------------------------------------------------
This code works just fine like that, but when I place it in a sub procedure
and call it in response to an onclick event, the redirect never happens. I
even placed an alert box in the if block ot verify that I was getting into
the block. I got the alert, but no redirect. Why doesn't this work in
repsonse to an onclick event, but it deos work by itself in a separate page?
Thanks.
Jerry 5 1447
well, this should be on a javascript thread but I aswer you
do a return false to the event, cause the button is posting the form
the and redirect is never happening
Are you talking about an actual server-side onClick event handler in
ASP.NET?
Your code is running client-side, instead of using JavaScript, you are using
VBScript, but it's still client-side (running in the browser). A server
side method can't call a client-side one.
Karl
--
MY ASP.Net tutorials http://www.openmymind.net/
<rl*****@newsgr oups.nospam> wrote in message
news:Of******** ******@tk2msftn gp13.phx.gbl... Looking to do something pretty simple... I have a cancel button on my page. When the user clicks it, i want to verify they want to cancel and if so, redirect them.
Code: ------------------------------------------------------------- <html> <script language=vbscri pt> if MsgBox("Testing ",4) = 6 Then window.location = "http://www.google.com" End if </script> </html> --------------------------------------------------------------
This code works just fine like that, but when I place it in a sub procedure and call it in response to an onclick event, the redirect never happens. I even placed an alert box in the if block ot verify that I was getting into the block. I got the alert, but no redirect. Why doesn't this work in repsonse to an onclick event, but it deos work by itself in a separate page? Thanks.
Jerry
Karl - This is supposed to be client side stuff. There is no need to post
back to the server if the client is not interested in canceling the
transaction. The onclick event is calling a client side sub defined in a
script block.
Henrique - This is being done in vbscript because the javascript
confirmation dialog doesn't allow you to specify the text on the buttons and
it can get confusing for an end user to confirm cancelation with an Okay
button and Cancel cancelation with a "Cancel" button which is what they used
to get the confirmation window to begin with. With the vbscript messagebox
I can display Yes and No buttons instead.
So the problem seems to be that the input element is causing a postback
which is canceling the redirect?
Is there a way in VBscript to keep this from happening so I can keep my Yes
and No buttons.
I'm really not interested in creating a custom dialog for this so I can make
it more user friendly with javascript...
Thanks for the responses.
Jerry
<rl*****@newsgr oups.nospam> wrote in message
news:Of******** ******@tk2msftn gp13.phx.gbl... Looking to do something pretty simple... I have a cancel button on my
page. When the user clicks it, i want to verify they want to cancel and if so, redirect them.
Code: ------------------------------------------------------------- <html> <script language=vbscri pt> if MsgBox("Testing ",4) = 6 Then window.location = "http://www.google.com" End if </script> </html> --------------------------------------------------------------
This code works just fine like that, but when I place it in a sub
procedure and call it in response to an onclick event, the redirect never happens.
I even placed an alert box in the if block ot verify that I was getting into the block. I got the alert, but no redirect. Why doesn't this work in repsonse to an onclick event, but it deos work by itself in a separate
page? Thanks.
Jerry
Well, you have to make if a function that return false always to the
event so the post back wont happen
Right... But I can't seem to find a way to make that happen in VBScript.
I've worked around it by having a JavaScript function call the VBScript
function.
The VBScript shows the dialog the way I want it to appear and the JavaScript
returns the value the way the browser needs it.
A bit klunky, perhaps, but it works.
"Henrique Mello" <hm****@gmail.c om> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. . Well, you have to make if a function that return false always to the event so the post back wont happen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: bhennon |
last post by:
Hey all,
I have a small php script that calls a random image at the following
page.
http://www.2006ymcanationals.com/random.php
IT WORKS IF I go directly to the above link.
I am trying to call that in another page so that i get a random image
the page is http://2006ymcanationals.com/index.php using <img
|
by: Michael Foord |
last post by:
#!/usr/bin/python -u
# 15-09-04
# v1.0.0
# auth_example.py
# A simple script manually demonstrating basic authentication.
# Copyright Michael Foord
# Free to use, modify and relicense.
# No warranty express or implied for the accuracy, fitness to purpose
|
by: Brian Tozer |
last post by:
I have put a stationery page that I am working on online at:-
http://homepages.ihug.co.nz/~briantoz/stolenkiss/stolenkiss3.html
Although there is a bug that causes it to only display the top half of the
picture, that is not my query.
I want to have a splash page effect which has just a logo and an open button
which when selected enables the existing display with it's animated snake.
Any help at accomplishing this example will be very...
|
by: Mark Fox |
last post by:
Hello,
I am attempting to do something very simple. I have
a page MainPage.aspx and a popup window Popup.aspx. When
users click on the linkbutton in the popup window I am
looking to do some server side processing in Popup.aspx,
then have the popup window close, and have the
MainPage.aspx do a postback to the server. But I am
having trouble determining what client side javascript
Popup.aspx should render after it does its server side
|
by: Fabrizio Cyber |
last post by:
Hi all,
I want to use a .js into a visual basic project. How can I do it ? I've
tried to open the script code into my project....and then ??? I see the code
but I don't jnow how to make it interact with the vb program.
Every kind of help is well accepted.
Thank you .
| |
by: usenet |
last post by:
How and where can one find out about the basics of VB/Access2003
syntax?
I am a died in the wool C/C++/Java Linux/Unix programmer and I am
finding it difficult to understand the program format for accessing
objects, controls, etc. in VB/Access2003.
In particular where will I find explanations of:-
Actions, Functions, Methods, Properties - I'm understand the
|
by: craig.burrell |
last post by:
I'm not a Javascript programmer, and I have a basic question about how
scripts may make use of libraries in Javascript. I thank everyone for
humouring me.
Do all of the libraries required by a script have to reside in the
host environment, or may a custom library be bundled with the script
itself?
I ask because I am trying to assess the significance of Alexander
Sotirov's <a href="http://www.determina.com/security.research/
|
by: Goran Djuranovic |
last post by:
Hi all,
I am experiencing a strange thing happening with a "designer.vb" page. Controls I manually declare in this page are automatically deleted after I drop another control on a ".aspx" page.
- Why is this happening?
- Can I disable automatic declaration and have everything be declared manually?
- Any other options to fix this?
Thanks in advance.
Goran Djuranovic
|
by: OccasionalFlyer |
last post by:
I am pretty new to JavaScript and having trouble with something that
should, I think, be fairly easy.
I have one form.
I have two radio buttons.
I have a text box that is hidden.
If you click the radio button that has the value "Yes", the hidden
field should be made visible.
I would appreciate help knowing what I did wrong. Here is the
|
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...
|
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,...
| |
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,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
| |
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |