473,804 Members | 3,018 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help - Registered Javascript not executing

Hi,
On my Webform my ASP:Button does not execute the Javascript code which is
'added' to it on the page load, and I'm trying to figure out why. Please
take a look at my code and the error message and see if there's anything
obvious here:

'------ Here's where the javascript is registered and added to the ASP:Button:

Sub Page_Load()
Call setupClientScri pt()
If Not IsPostBack Then
btnUpdate.Attri butes.Add("oncl ick", "return ConfirmUpdate() ;")
End if
End sub

Private Sub setupClientScri pt()
Dim js As String
js = "<script language=JavaSc ript> " & _
"Function ConfirmUpdate() " & _
"{ " & _
"return confirm('xxxx?' ); " & _
"} " & _
"</script>"

'Register the script
If (Not IsClientScriptB lockRegistered( "ConfirmUpdate" )) Then
RegisterClientS criptBlock("Con firmUpdate", js)
End If
End Sub

'------ Here's what I see when I view the source code when the page loads:
<form......
<script language=JavaSc ript> Function ConfirmUpdate() { return
confirm('xxxx?' ); } </script>
.......
<TD vAlign="top" align="left">
<input type="submit" name="btnUpdate " value="Save Changes" onclick="return
ConfirmUpdate() ;if (typeof(Page_Cl ientValidate) == 'function')
Page_ClientVali date(); " language="javas cript" id="btnUpdate" />

</TD>
......</form>

'------ And here's the error I see when I click on the little yellow
exclamation mark in the bottom left corner of the browser when I click on the
button:

Line: 20
Char: 11
Error: Expected ';'
Code: 0

So, I get this error and I do not get the pop-up confirmation window. Does
anybody recognize this error? Any help is appreciated.

Thanks,
John
Nov 19 '05 #1
2 1540
javascript is case sensitive. "function" needs to be lowercase, and you
should use "window.confirm ()" to be browser friendly.

-- bruce (sqlwork.com)
"John Walker" <Jo********@dis cussions.micros oft.com> wrote in message
news:E0******** *************** ***********@mic rosoft.com...
Hi,
On my Webform my ASP:Button does not execute the Javascript code which is
'added' to it on the page load, and I'm trying to figure out why. Please
take a look at my code and the error message and see if there's anything
obvious here:

'------ Here's where the javascript is registered and added to the
ASP:Button:

Sub Page_Load()
Call setupClientScri pt()
If Not IsPostBack Then
btnUpdate.Attri butes.Add("oncl ick", "return ConfirmUpdate() ;")
End if
End sub

Private Sub setupClientScri pt()
Dim js As String
js = "<script language=JavaSc ript> " & _
"Function ConfirmUpdate() " & _
"{ " & _
"return confirm('xxxx?' ); " & _
"} " & _
"</script>"

'Register the script
If (Not IsClientScriptB lockRegistered( "ConfirmUpdate" )) Then
RegisterClientS criptBlock("Con firmUpdate", js)
End If
End Sub

'------ Here's what I see when I view the source code when the page loads:
<form......
<script language=JavaSc ript> Function ConfirmUpdate() { return
confirm('xxxx?' ); } </script>
......
<TD vAlign="top" align="left">
<input type="submit" name="btnUpdate " value="Save Changes" onclick="return
ConfirmUpdate() ;if (typeof(Page_Cl ientValidate) == 'function')
Page_ClientVali date(); " language="javas cript" id="btnUpdate" />

</TD>
.....</form>

'------ And here's the error I see when I click on the little yellow
exclamation mark in the bottom left corner of the browser when I click on
the
button:

Line: 20
Char: 11
Error: Expected ';'
Code: 0

So, I get this error and I do not get the pop-up confirmation window.
Does
anybody recognize this error? Any help is appreciated.

Thanks,
John

Nov 19 '05 #2
Bruce,
Thanks! Changing the case fixed the problem. But I ran into one more
issue; when I try to "Attribute. Add" this same function to a Datagrid
Checkbox, it puts it in the <span> section (which I see when I "view
source"), and it doesn't fire the function when the check box is changed.
Here's the html, do you see anything wrong here:

<span class="CssRepor tCell" OnCheckedChange d="SetChangeFla g();"><input
id="dgrdTRFP_dg rdReport__ctl2_ chkDispatched" type="checkbox"
name="dgrdTRFP: dgrdReport:_ctl 2:chkDispatched " checked="checke d" /></span>

Thanks again!

"Bruce Barker" wrote:
javascript is case sensitive. "function" needs to be lowercase, and you
should use "window.confirm ()" to be browser friendly.

-- bruce (sqlwork.com)
"John Walker" <Jo********@dis cussions.micros oft.com> wrote in message
news:E0******** *************** ***********@mic rosoft.com...
Hi,
On my Webform my ASP:Button does not execute the Javascript code which is
'added' to it on the page load, and I'm trying to figure out why. Please
take a look at my code and the error message and see if there's anything
obvious here:

'------ Here's where the javascript is registered and added to the
ASP:Button:

Sub Page_Load()
Call setupClientScri pt()
If Not IsPostBack Then
btnUpdate.Attri butes.Add("oncl ick", "return ConfirmUpdate() ;")
End if
End sub

Private Sub setupClientScri pt()
Dim js As String
js = "<script language=JavaSc ript> " & _
"Function ConfirmUpdate() " & _
"{ " & _
"return confirm('xxxx?' ); " & _
"} " & _
"</script>"

'Register the script
If (Not IsClientScriptB lockRegistered( "ConfirmUpdate" )) Then
RegisterClientS criptBlock("Con firmUpdate", js)
End If
End Sub

'------ Here's what I see when I view the source code when the page loads:
<form......
<script language=JavaSc ript> Function ConfirmUpdate() { return
confirm('xxxx?' ); } </script>
......
<TD vAlign="top" align="left">
<input type="submit" name="btnUpdate " value="Save Changes" onclick="return
ConfirmUpdate() ;if (typeof(Page_Cl ientValidate) == 'function')
Page_ClientVali date(); " language="javas cript" id="btnUpdate" />

</TD>
.....</form>

'------ And here's the error I see when I click on the little yellow
exclamation mark in the bottom left corner of the browser when I click on
the
button:

Line: 20
Char: 11
Error: Expected ';'
Code: 0

So, I get this error and I do not get the pop-up confirmation window.
Does
anybody recognize this error? Any help is appreciated.

Thanks,
John


Nov 19 '05 #3

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

Similar topics

1
1306
by: Phre2d | last post by:
We are attempting to move a large development project into the .NET age over time. We have a large number of ATL-based COM objects in this project. Following the "Journal Poster" example provided by MS, I have converted some of my COM projects into mixed code so that there is both a .NET and COM interface to the underlying logic. So far, so good. In one of these former COM projects, four additional COM objects are within from the...
15
2587
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
0
5578
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted ******************************************************** For this teeny job, please refer to: http://feeds.reddit.com/feed/8fu/?o=25
8
2054
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for button A's mouseup has completed? I beleive event processing to be single-threaded for good reason but I need a "stop" button and it's no good if it doesn't do anything until the other processing has finished :-)
5
1512
by: shanti | last post by:
hai, i have developed a c-code to push integers into a stack (an array). in the program there are three inputs which has to be given through keyboard. the inputs are "choice", "option","S_R_NO" and "i" all are defined as "int". now when the inputs given are int type the program behaviour is as required. but when the input given are char type the program is executing infinite loop.i could not understand this behaviour and i am unable to...
8
3222
by: Pratik Patel | last post by:
Hello, I used innerHTML to assign HTML content. but in my HTML page content have also some javascript function and it will run when page load. bu when HTML code assgin thru innerHTML then this javascript is not working. e.g. html content:
15
7032
by: rage3324 | last post by:
I am posting html onto my main page between div tags using xmlhttprequest and innerhtml. The html I am posting has javascript inside which I am executing using the eval() function. However, the problem I face is that the javascript uses innerhtml as well and will not work for some reason. I have tested the javascript and it is definitely executing, it just will not change the innerhtml. To be more clear, the innerhtml is trying to access...
1
1546
by: Cartoper | last post by:
I am trying to deploy a .Net 1.1 project using the VS2003 setup program. I need one assembly to be registered as a COM object via regasm. How does one go about doing that in the VS2003 setup program? Cartoper
5
3313
by: dm3281 | last post by:
I'm really starting to hate writing services -- or trying to, anyway. Why do I need to rename my project to the service name? Why do I need to set the "ServiceName" property to my service name? Why do I need to set a property within my code to the service name? Are all these required or am I just doing this for consistency purposes?
0
9591
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,...
0
10343
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...
0
10087
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9166
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...
1
7631
isladogs
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...
0
5529
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
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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
3
3001
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.