Hi guys,
I searched around without any clear answer. Tons of stuff, but nothing concrete.
I am trying to call this Javascript function:
function ButtonClicked()
{
alert("The button has been clicked.");
}
Calling it from an HTML button is no problem at all. But there is no way I can call that function from an ASP button. I tried from the HTML side or the aspx side.
I understood that an ASP button run only on the server. But I can't believe you can't make that simple call. I really hate to use HTML button when the design with ASP on a Web Form is so fast and easy.
Since I am a newbie, some code example will be appreciated.
Briefly, I have an ASP button that I want to call the Javascript function "ButtonClicked"
Thanks
Frag 11 4635
Frag wrote: Hi guys,
I searched around without any clear answer. Tons of stuff, but nothing concrete.
I am trying to call this Javascript function:
function ButtonClicked() { alert("The button has been clicked."); }
Calling it from an HTML button is no problem at all. But there is no way I can call that function from an ASP button. I tried from the HTML side or the aspx side.
I understood that an ASP button run only on the server. But I can't believe you can't make that simple call. I really hate to use HTML button when the design with ASP on a Web Form is so fast and easy.
Since I am a newbie, some code example will be appreciated.
Briefly, I have an ASP button that I want to call the Javascript function "ButtonClicked"
Thanks
Frag
Hi Frag,
I haven't got a clue what an ASP-button is, but if it is some HTML generated
by a tool, just look into the code it produces.
If you see <a href="">blabla</a> that is where you can try to add some
simple code in the anchor, like onClick="".
If the code is always generated dynamically, you should read in the specs
how to add extra things to it (if possible).
Regards,
Erwin Moller
Public Sub btnCallJavascript_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnCallJavascript.Click
lblScript.Text = "<SCRIPT
language='Javascript1.2'>popUp)
</SCRIPT>"
End Su
Unregistered
-----------------------------------------------------------------------
Posted via http://www.forum4designers.co
-----------------------------------------------------------------------
View this thread: http://www.forum4designers.com/message36240.htm
Unregistered wrote: Public Sub btnCallJavascript_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCallJavascript.Click
lblScript.Text = "<SCRIPT language='Javascript1.2'>popUp) </SCRIPT>"
Why do people continue to use the outdated language attribute? And when
they do use it, they use a buggy version number without knowing the
possible implications of it?
<script language="javascript1.2">
a = 30;
b = 40;
if (a = b){
alert('They are equal')
}
else{
alert('They are not equal')
}
</script>
Test the above in Netscape 4.xx, and then any other browser. End Sub
Unregistered - ------------------------------------------------------------------------ Posted via http://www.forum4designers.com ------------------------------------------------------------------------ View this thread: http://www.forum4designers.com/message36240.html
You really should get a real newsreader and subscribe to
new:comp.lang.javascript and stop using a site that portrays itself as a
"private forum" when it is anything but that.
Its more a joke than anything else.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
"Randy Webb" <hi************@aol.com> wrote in message
news:Wq********************@comcast.com...
<snip> <script language="javascript1.2"> a = 30; b = 40; if (a = b){ alert('They are equal') } else{ alert('They are not equal') } </script> Test the above in Netscape 4.xx, and then any other browser.
It might be best not to do the comparison with IceBrowser as it uses the
Rhino javascript engine and the docs for Rhino say it will respect
language="javascript1.2" and use the alternative type-converting rules
(though I have never tested that, not using the language attribute
myself anymore).
It is a bit unfair to use the text "They are equal" when the test you
are performing is an assignment (not comparison), though it adequately
illustrates the problem.
Here are a few comparisons illustrations of the differences:-
<html>
<head>
<title></title>
</head>
<body>
<script language="javascript1.2">
if("40" == 40){
document.write('("40" == 40) is true.<br>')
}else{
document.write('("40" == 40) is false.<br>')
}
if(0 == false){
document.write('(0 == false) is true.<br>')
}else{
document.write('(0 == false) is false.<br>')
}
if("" == false){
document.write('("" == false) is true.<br>')
}else{
document.write('("" == false) is false.<br>')
}
</script>
</body>
</html> Posted via http://www.forum4designers.com
<snip>You really should get a real newsreader and subscribe to new:comp.lang.javascript and stop using a site that portrays itself as a "private forum" when it is anything but that.
I think that they have abandoned the pretence that they are a private
forum, though they have done little to dray attention to the reality and
are maintaining a number of other deceptions related to that original
one.
But they have also stopped fully reporting comp.lang.javascirpt. So,
with no guarantee that any response made to someone posting from
forum4designers.com will even be seen there, and knowing that any reply
made will be garbled by inappropriate presentation, it is questionable
whether it is worth anyone's effort to compose a worthwhile response to
posts originating on that site.
Its more a joke than anything else.
A bad joke.
Richard.
Richard Cornford wrote: "Randy Webb" <hi************@aol.com> wrote in message news:Wq********************@comcast.com... <snip>
<script language="javascript1.2"> a = 30; b = 40; if (a = b){ alert('They are equal') } else{ alert('They are not equal') } </script> Test the above in Netscape 4.xx, and then any other browser.
It might be best not to do the comparison with IceBrowser as it uses the Rhino javascript engine and the docs for Rhino say it will respect language="javascript1.2" and use the alternative type-converting rules (though I have never tested that, not using the language attribute myself anymore).
Just one more reason *not* to use the language attribute.
It is a bit unfair to use the text "They are equal" when the test you are performing is an assignment (not comparison), though it adequately illustrates the problem.
In Netscape 4.xx with language="javascript1.2", it does a comparison,
not an assignment. Since they are not equal, it will alert that they are
not equal. In modern browsers then it alerts they are equal because it
can set the assignment, thus its true, so it alerts.
Perhaps:
<script language="javascript1.2">
a = 30;
b = 40;
if (a = b){
alert('I honor it as an assignment')
}
else{
alert('I honor it as a comparison')
}
</script>
Might have been better alerts.
<--snip--> Posted via http://www.forum4designers.com
<snip>
You really should get a real newsreader and subscribe to new:comp.lang.javascript and stop using a site that portrays itself as a "private forum" when it is anything but that.
I think that they have abandoned the pretence that they are a private forum, though they have done little to dray attention to the reality and are maintaining a number of other deceptions related to that original one.
I am not so sure they have. They censor out the part of the posts that
we normally quote/complain about. Namely, the generated signature thats
get posted. When viewing the post on the site, you do not see that
section of the post. But they showed my signature line (and yours as well). http://www.forum4designers.com/message36240.html
Is this very thread, and if you look at the post that I replied to,
there is no signature on it telling where it was posted from nor the
link to the thread.
But they have also stopped fully reporting comp.lang.javascirpt. So, with no guarantee that any response made to someone posting from forum4designers.com will even be seen there, and knowing that any reply made will be garbled by inappropriate presentation, it is questionable whether it is worth anyone's effort to compose a worthwhile response to posts originating on that site.
And miss out on all this fun? You are kidding me, right? <g>
Actually, they showed this entire thread (so far anyway). Will be
interesting to see if anything from my post after gets "lost" or not.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
"Randy Webb" <hi************@aol.com> wrote in message
news:et********************@comcast.com...
<snip> In Netscape 4.xx with language="javascript1.2", it does a comparison,
<snip>
You are right it does. How on earth can it decide when it is supposed to
be doing comparison and when it is supposed to be doing assignment? I
use the result of assignment expressions in - if - statements all the
time. In practice it is not very important if the language attribute is
not used at all but given how often I see scripts with version 1.2
language attributes I am surprised we don't see more problems directly
resulting from them (or could that just be the result of limited
testing).
<snip>... . But they showed my signature line (and yours as well).
Do they? I don't recall posting with a signature during the period in
which they have been operating.
<snip> ... , it is questionable whether it is worth anyone's effort to compose a worthwhile response to posts originating on that site.
And miss out on all this fun? You are kidding me, right? <g>
<snip>
I will copy and paste a pre-written standard response. No effort, no
waste if it is not reported, potentially as much fun.
Richard.
Richard Cornford wrote: "Randy Webb" <hi************@aol.com> wrote in message news:et********************@comcast.com... <snip>
In Netscape 4.xx with language="javascript1.2", it does a comparison, <snip>
You are right it does. How on earth can it decide when it is supposed to be doing comparison and when it is supposed to be doing assignment?
Its a bug in the if conditional in javascript1.2 specifically. So it
only shows itself when you do if(something=somethingElse) instead of
if(something==somethingElse). I have never tested it in any other
conditionals (while and for loops).
I use the result of assignment expressions in - if - statements all the time. In practice it is not very important if the language attribute is not used at all but given how often I see scripts with version 1.2 language attributes I am surprised we don't see more problems directly resulting from them (or could that just be the result of limited testing).
If its inside an if statement, it will do a comparison. Otherwise, it
does as its supposed to do. As far as I know, if (a=b) will always
result in true in modern browsers (the exception would be if a was read
only).
<snip>
... . But they showed my signature line (and yours as well).
Do they? I don't recall posting with a signature during the period in which they have been operating.
I am so used to seeing signatures at the bottom, that I mistook your
name for a signature. It shows mine, so its actively censoring what it
appends to the posts.
<snip>
... , it is questionable whether it is worth anyone's effort to compose a worthwhile response to posts originating on that site.
And miss out on all this fun? You are kidding me, right? <g>
<snip>
I will copy and paste a pre-written standard response. No effort, no waste if it is not reported, potentially as much fun.
Post it when you get it written. Maybe we could add a very unique word
so that people could filter it out (much like the FAQ gets filtered by
some), but based on content instead of subject lines. Or better, a
unique phrase "forum4webdesigner's site ........."
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
"Randy Webb" <hi************@aol.com> wrote in message
news:8P********************@comcast.com...
<snip> ... . As far as I know, if (a=b) will always result in true in modern browsers ...
<snip>
The evaluated result of an assignment expression is the value assigned:-
var obj;
if(obj = document.getElementById("someID")){
... //only if - obj - is assigned non-null value
}
- so it can type-convert to both true and false.
Richard.
Randy Webb <hi************@aol.com> writes:
[ if (a=b) in JS1.2] Its a bug in the if conditional in javascript1.2 specifically.
I like to think so too, but I guess it was considered a "feature".
I.e., it was deliberate. Good thing it was stopped in time!
As far as I know, if (a=b) will always result in true in modern browsers (the exception would be if a was read only).
.... or if b counts as false.
Try
var a=42;
var b=0;
if (a=b) {} else {alert("b false or JS 1.2 in effect");}
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Lasse Reichstein Nielsen wrote: Randy Webb <hi************@aol.com> writes:
[ if (a=b) in JS1.2]
Its a bug in the if conditional in javascript1.2 specifically.
I like to think so too, but I guess it was considered a "feature". I.e., it was deliberate. Good thing it was stopped in time!
Netscape 4 was enough to drive a teetotaler to drink and an atheist to
religion. Yes, its a very good thing it was stopped :) As far as I know, if (a=b) will always result in true in modern browsers (the exception would be if a was read only).
.... or if b counts as false. Try var a=42; var b=0; if (a=b) {} else {alert("b false or JS 1.2 in effect");}
Yikes! Just when I thought I had it figured out, they type convert on
me. Sheesh. I think I will just stick to == and be happy :)
--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/ This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Keiron Waites |
last post by:
Ok to understand what I'm doing you'll have to load the HTML file attached
(code also below):
When you select an item on the left and select the ">>" button, some alerts
will come up telling you...
|
by: Digital Puer |
last post by:
I have the following HTML form:
- radio button A (default selected)
- radio button B
- input field, of type "file" with "Choose" button
- submit button
I would like to have it so that if the...
|
by: 42 |
last post by:
I implemented a simple class inherited from Page to create a page
template. It simply wraps some trivial html around the inherited page,
and puts the inherited page into a form.
The problem I...
|
by: Marc |
last post by:
How could I directly trigger a very simple on localhost and a known port
listening server from my internet browser client? Local host means the
little server would be running on the client machine,...
|
by: one man army |
last post by:
Hi All-
I am new to PHP. I found FAQTS and the php manual. I am trying this
sequence, but getting 'no zip string found:'... PHP Version 4.4.0
$doc = new DomDocument;
$res =...
|
by: Evan |
last post by:
Hey, I posted this yesterday, but no one had any ideas? C'mon now, I
know this isn't that hard, i'm just a little new to javascript, and I
can't quite figure this out. I searched and searched to...
|
by: Knut Olsen-Solberg |
last post by:
I try to change the text in a <p> using getElementById(). I wonder what properties exists, and which one to use here. (The following does not work.)
Regards Knut
______________________
...
|
by: firstcustomer |
last post by:
Hi,
Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that
someone will be able to point me to a ready-made solution to my
problem!
A friend of mine (honest!) is wanting to...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
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...
|
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,...
|
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...
|
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: 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,...
| |