473,394 Members | 1,752 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,394 software developers and data experts.

Call the function - simulation

All,

Does anybody know how can I simulate the button click from the JavaScript on
ASPX page? Here is the fragment of the ASPX page with a simple JavaScript
allowing me to do something before the page Unloads:

<script lang="JavaScript">
function OnUnLoad(){
alert("You want to leave this page,
pleaes save your data first!");
var userInput = confirm("Do you wish to
save the data modified on this page?");
if (userInput==true)
{
alert("The data is saved")
}
else
{
alert("All latest
modifications are lost")
}
}
</script>
</HEAD>

<body scroll="yes" onload="RefreshTray()" MS_POSITIONING="GridLayout"
onunload='OnUnLoad()'>

I also have a button on this page allowing me to save the data and the
implementation is written in C# in the code behind. Can I simulate this
button clicking inside this JavaScript and how? Or this idea is basically
wrong and I need to do anything else? What exectly? Any idea?

Thanks,
Just D.
Nov 20 '05 #1
1 1063
you can just do

document.forms[0].submit();

note: no server side button event will fire. you can call the button click

document.getElementById("buttonid").onclick();

-- bruce (sqlwork.com)

"Just D." <no@spam.please> wrote in message
news:Xxpff.396$4v.72@fed1read03...
All,

Does anybody know how can I simulate the button click from the JavaScript
on ASPX page? Here is the fragment of the ASPX page with a simple
JavaScript allowing me to do something before the page Unloads:

<script lang="JavaScript">
function OnUnLoad(){
alert("You want to leave this page,
pleaes save your data first!");
var userInput = confirm("Do you wish to
save the data modified on this page?");
if (userInput==true)
{
alert("The data is saved")
}
else
{
alert("All latest
modifications are lost")
}
}
</script>
</HEAD>

<body scroll="yes" onload="RefreshTray()" MS_POSITIONING="GridLayout"
onunload='OnUnLoad()'>

I also have a button on this page allowing me to save the data and the
implementation is written in C# in the code behind. Can I simulate this
button clicking inside this JavaScript and how? Or this idea is basically
wrong and I need to do anything else? What exectly? Any idea?

Thanks,
Just D.

Nov 20 '05 #2

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

Similar topics

1
by: Steaming Balturd | last post by:
are there any php based economic simulations out there - not trading games per se, but more like simulating an economy, be it running a business or running a government? All i've been able to...
0
by: Constandinos Mavromoustakis | last post by:
Dear all, first we apologize if you receive multiple copies of this announcement. please see below if you are interested. Thank you in advance....
0
by: Gitesh | last post by:
..................... CALL FOR PAPERS ..................... The 2004 International Multiconference in Computer Science and Computer Engineering (18 Joint Int'l Conferences)...
0
by: Constandinos Mavromoustakis | last post by:
http://agent.csd.auth.gr/~cmavrom -------------------------------------------------- ============================================================================ = 37th Annual Simulation...
19
by: Nicolas Pernetty | last post by:
Hello, I'm looking for any work/paper/ressource about continuous system simulation using Python or any similar object oriented languages (or even UML theory !). I'm aware of SimPy for...
0
by: Karatza Helen | last post by:
Our apologies if you have received multiple copies -------------------------------------------------- Call for Papers: 38th Annual Simulation Symposium Part of the 2005 Spring Simulation...
19
by: Riko Wichmann | last post by:
hi everyone, I'm googeling since some time, but can't find an answer - maybe because the answer is 'No!'. Can I call a function in python inline, so that the python byte compiler does...
1
by: Tim Silva | last post by:
SDX Modeling, Simulation and Numerical Computing Environment for science and engineering has now been released. Major features include: * A unified simulation environment for modeling virtually...
4
by: Richard Blackwood | last post by:
Hello all. I have a few questions about simulation programming. One, do all programmers know to how to code a simulation? By simulation I mean a model of real world relationships (i.e. like...
22
by: Nehil | last post by:
Does C follow call by value convention or call by reference? i see that there is nothing like reference in C standard but it is referenced. still, what should be the answer for the above...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
marktang
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,...
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
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...
0
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...

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.