473,748 Members | 4,067 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript Button Click

This problem only exists in IE, due to UI restrictions I'm using a
href in an error label to bring up a modal popup. I'm using a callback
to filter a grid on the popup.

The problem:

The href has javascript:btn. click() basically, which in Firefox causes
a postback after it's clicked. IE works fine without posting back,
this is suppose to be an instant popup and the postback defeats the
whole purpose. Any ideas?

Sep 18 '07 #1
8 6952
On Sep 18, 9:08 am, Deft....@gmail. com wrote:
This problem only exists in IE, due to UI restrictions I'm using a
href in an error label to bring up a modal popup. I'm using a callback
to filter a grid on the popup.

The problem:

The href has javascript:btn. click() basically, which in Firefox causes
a postback after it's clicked. IE works fine without posting back,
this is suppose to be an instant popup and the postback defeats the
whole purpose. Any ideas?
Sorry correction this problem only occurs in Firefox, sorry for the
confusion.

Sep 18 '07 #2
I've found a solution, Firefox does not treat element.click() the same
as IE, I decided to use the element.dispatc hEvent(evt) for other
browsers, IE does not support dispatchEvent, rather fireEvent.

BTW, pointedears, I find it astonishing you are replying to a
javascript thread without knowing the term postback.

http://en.wikipedia.org/wiki/Postback

Thanks anyway for the suggestion on removing the javascript:meth od()
syntax, I have since replaced it.

Sep 18 '07 #3
De******@gmail. com wrote:
[...]
BTW, pointedears, I find it astonishing you are replying to a
javascript thread without knowing the term postback.

http://en.wikipedia.org/wiki/Postback
| This article is considered orphaned, since there
| are few or no other articles linked to this one.
| [...]
| This software-related article is a stub.
Thanks anyway for the suggestion on removing the javascript:meth od()
syntax, I have since replaced it.
Good.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8************ *******@news.de mon.co.uk>
Sep 18 '07 #4
On Sep 18, 10:16 am, Deft....@gmail. com wrote:
I've found a solution, Firefox does not treat element.click() the same
as IE, I decided to use the element.dispatc hEvent(evt) for other
browsers, IE does not support dispatchEvent, rather fireEvent.

BTW, pointedears, I find it astonishing you are replying to a
javascript thread without knowing the term postback.

http://en.wikipedia.org/wiki/Postback

Thanks anyway for the suggestion on removing the javascript:meth od()
syntax, I have since replaced it.
The term postback has nothing to do with javascript. It is a term used
in .NET to describe web pages being sent to the server for server-side
processing and has nothing to do with javascript.

Sep 18 '07 #5
On Sep 18, 3:23 pm, Deft....@gmail. com wrote:
The href has javascript:btn. click() basically, which in Firefox causes
a postback after it's clicked. IE works fine without posting back,
I have recently found that in situations where you want to avoid
displaying the script result in the browser window (which I assume is
what you mean by postback) you can try replacing

javascript:some thing

with

javascript:func tion(){somethin g();}()

It's ever so slightly weird, but it does the trick. Can be used for
adding scripts to your bookmarks too, if ever you had reason to do so.

Sep 19 '07 #6
AndrewTK wrote:
On Sep 18, 3:23 pm, Deft....@gmail. com wrote:
>>The href has javascript:btn. click() basically, which in Firefox causes
a postback after it's clicked. IE works fine without posting back,

I have recently found that in situations where you want to avoid
displaying the script result in the browser window (which I assume is
what you mean by postback) you can try replacing

javascript:some thing

with

javascript:func tion(){somethin g();}()

It's ever so slightly weird, but it does the trick. Can be used for
adding scripts to your bookmarks too, if ever you had reason to do so.
It "does the trick" because that function returns `undefined'.
void(something( )) would also have "worked".

*Please* read the FAQ before posting:

http://jibbering.com/faq/#FAQ2_3
http://jibbering.com/faq/#FAQ4_24

It is not that hard to miss, especially as the FAQ Poster script will post
each single FAQ here frequently.
PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Sep 19 '07 #7
On Sep 19, 7:22 am, Thomas 'PointedEars' Lahn <PointedE...@we b.de>
wrote:
AndrewTK wrote:
On Sep 18, 3:23 pm, Deft....@gmail. com wrote:
>The href has javascript:btn. click() basically, which in Firefox causes
a postback after it's clicked. IE works fine without posting back,
I have recently found that in situations where you want to avoid
displaying the script result in the browser window (which I assume is
what you mean by postback) you can try replacing
javascript:some thing
with
javascript:func tion(){somethin g();}()
It's ever so slightly weird, but it does the trick. Can be used for
adding scripts to your bookmarks too, if ever you had reason to do so.

It "does the trick" because that function returns `undefined'.
void(something( )) would also have "worked".

*Please* read the FAQ before posting:

http://jibbering.com/faq/#FAQ2_3http...m/faq/#FAQ4_24

It is not that hard to miss, especially as the FAQ Poster script will post
each single FAQ here frequently.

PointedEars
--
"Use any version of Microsoft Frontpage to create your site. (This won't
prevent people from viewing your source, but no one will want to steal it.)"
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>- Hide quoted text -

- Show quoted text -
Yes that would stop the postback but doesn't do the trick in this
situation. I posted the solution, which is completley javascript
related and not in the FAQ though it could be.

The real breakdown here is that other browsers don't treat
button.click() the same as their dispatchEvent(e vnt), which is non-
intuitive. This was tested with Firefox and IE, IE doesn't support
dispatchEvent instead fireEvent. I want a real standard to call for
clicking a button via javascript, without conditional
statements. .click() is supported by the 2 main browsers but
implemented totally different.

Does anyone have an explanation for this behavior? I just want to know
if there is a real reason not to simply call the dispatchEvent(e vnt)
from .click(). I'm not one to defend IE, but their .click() method
works, in my testing, just like their fireEvent() method. I'm not
sure why Firefox in this example treats the click() and
dispatchEvent() methods differently. I would guess security related,
but I'm not sure.

So Postback isn't javascript related, ok but what do you call when the
page refreshes in javascript terms? Just a Post? I am a .NET developer
but I was assuming Postback was a geneic web developer term.

-Jab

Sep 19 '07 #8
On Sep 19, 2:55 pm, Deft....@gmail. com wrote:
<snip>
So Postback isn't javascript related, ok but what do you call
when the page refreshes in javascript terms?
It is doubtful that you ever do "refreshes in javascript". Possibly
"with javascript" but then you would have to be specific about what
"refreshes" was intended to mean.
Just a Post? I am a .NET developer
but I was assuming Postback was a geneic web developer term.
When what you are describing are HTTP transactions the terminology
from HTTP is the precise, unambiguous and (theoretically) universal
tool for describing them.

Incidentally, that wikipedia page is worse than useless as "the entire
page and its contents are sent back to the server for processing" is
extremely unlikely to be true, as that would be both difficult to do
and a stupid thing to attempt.

Sep 19 '07 #9

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

Similar topics

4
2341
by: fig000 | last post by:
Hi, I'm relatively new to Javascript so please bear with me on what might sound like silly questions. This is what I want to do: I'm working in classic asp (I have to for this project). I need to: 1. Click a submit button on an asp page, calling another page that saves the contents of that form to a database and then displays
2
9054
by: JCE | last post by:
I need to programmatically invoke an asp:Button click event from a javascript function. The page containing the script and the button is the HTML page associated with a WebUserControl-derived object (both the HTML and control are built in the same .ascx file) The target button simply fires an event in the WebUserControl-derived object. So, alternatively, if there was a mechanism to call a method (explicitly or using an event of some...
4
5540
by: Carlo Marchesoni | last post by:
I have a button that opens a new Window (some kind of search-window), which is fired using JavaScript (btnSearch.Attributes=".....";) Now I need to run some code behind code BEFORE this JavaScript runs. I tried to define another Button with an EventHandler associated, and from this (after doing my code) fire 'btnSearch.click()'. But I can't make it work. I tried private void Button1_Click(object sender, System.EventArgs e RestartAll()...
6
2728
by: Shamin | last post by:
Hi, Thanks in advance for answering to my Question. I'm stuck with this problem and would really appreciate any help. I have 2 aspx files (Main.aspx and ReportViewer.aspx). Main.aspx has a datagrid which is populated with list of report names. When the user click on the name of a report, I display a panel that has a button which on clicking will run the report. The report will open in ReportViewer.aspx, This page has a Report Document...
1
5407
by: Jorge Ponte | last post by:
hi I have a Web User Control (ascx) - lets call it "My_WUC" - in a Web form. In that WUC I want have a textbox and a button. I want to click on the button and open a popup (I use javascript for that), the popup window will have also a text box and a button. when the User click on the button the value on the textbox will be send back to the textbox on My_WUC. I hope I was clear off what I want to do. I've been searching for some ideas...
6
1944
by: tshad | last post by:
I am trying to set up a Javascript popup box that has a way of sending back a message to asp.net on how to process some data. At the moment I am just doing: myNextButton.Attributes.Add("onclick", "return confirm('Are you sure you want finish this test?');") to attach a popup box to a button. The problem is that the buttons only say OK and Cancel. OK will take me to the event tied to the button and Cancel,
4
3515
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I click a button on a pop-up window the javascript for that button click does a 'button.form.submit'. On the Server side there is a Button click event for this button, but for some reason it no longer fires. It worked fine before and everything...
8
3674
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
7
3228
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the column need to be a date picker field. I know things will be easier with ASPX datagrid.
2
37691
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side functionality in the user's browser without having to make calls back to the server; thus, saving resources. The following example demonstrates how you can use an ASP.NET button to trigger a JavaScript call which modifies an ASP.NET TextBox. ...
0
8991
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, 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...
0
9544
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
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
9324
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
8243
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...
0
4606
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
4874
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2783
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.