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

Startup script problem

I'm registering a startup script in my "page load" event.
Everything works fine when I run it locally, but when it's
deployed to the webserver, it doesn't execute the
javascript which is inside a ".js" file (on the root
directory of the website).

Here is the HTML where I have the javascript function to
execute:
<code>
<TD style="HEIGHT: 23px">

<input name="txtEnding" type="text" value="100"
id="txtEnding" tabindex="24"
onChange="CalculateTotalMileage();"
style="width:96px;" /></TD>
</code>

Here is the code in my code behind page:
<code>
Private Sub Page_Load(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles MyBase.Load

RegisterScripts()
..
..
..

Private Sub RegisterScripts()

txtMileageBeginning.Attributes.Add
("onChange", "CalculateTotalMileage();")
txtEnding.Attributes.Add
("onChange", "CalculateTotalMileage();")
ddlDispatchInfo.Attributes.Add
("onChange", "EnableDispatchInfoOther();")

If (Not IsClientScriptBlockRegistered
("PageStartupJScript")) Then
RegisterClientScriptBlock
("PageStartupJScript", "<script language=""javascript""
src=""/EMSAssist/ClientFunctions.js""></script>")
End If

End Sub
</code>

Why isn't the web application recognizing the javascript
functions when it's deployed to the webserver?
Nov 19 '05 #1
2 1209
the path to the ClientFunctions.js is probably wrong.

type in

http://servername/vdirname/EMSAssist/ClientFunctions.js

and see if the file downloads

-- bruce (sqlwork.com)
"bill yeager" <an*******@discussions.microsoft.com> wrote in message
news:00****************************@phx.gbl...
| I'm registering a startup script in my "page load" event.
| Everything works fine when I run it locally, but when it's
| deployed to the webserver, it doesn't execute the
| javascript which is inside a ".js" file (on the root
| directory of the website).
|
| Here is the HTML where I have the javascript function to
| execute:
| <code>
| <TD style="HEIGHT: 23px">
|
| <input name="txtEnding" type="text" value="100"
| id="txtEnding" tabindex="24"
| onChange="CalculateTotalMileage();"
| style="width:96px;" /></TD>
| </code>
|
| Here is the code in my code behind page:
| <code>
| Private Sub Page_Load(ByVal sender As System.Object, ByVal
| e As System.EventArgs) Handles MyBase.Load
|
| RegisterScripts()
| .
| .
| .
|
| Private Sub RegisterScripts()
|
| txtMileageBeginning.Attributes.Add
| ("onChange", "CalculateTotalMileage();")
| txtEnding.Attributes.Add
| ("onChange", "CalculateTotalMileage();")
| ddlDispatchInfo.Attributes.Add
| ("onChange", "EnableDispatchInfoOther();")
|
| If (Not IsClientScriptBlockRegistered
| ("PageStartupJScript")) Then
| RegisterClientScriptBlock
| ("PageStartupJScript", "<script language=""javascript""
| src=""/EMSAssist/ClientFunctions.js""></script>")
| End If
|
| End Sub
| </code>
|
| Why isn't the web application recognizing the javascript
| functions when it's deployed to the webserver?
Nov 19 '05 #2
> I'm registering a startup script in my "page load" event.
Everything works fine when I run it locally, but when it's
deployed to the webserver, it doesn't execute the
javascript which is inside a ".js" file (on the root
directory of the website).
...
If (Not IsClientScriptBlockRegistered
("PageStartupJScript")) Then
RegisterClientScriptBlock
("PageStartupJScript", "<script language=""javascript""
src=""/EMSAssist/ClientFunctions.js""></script>")
End If
...
Why isn't the web application recognizing the javascript
functions when it's deployed to the webserver?


Have you got the same directory structure on your local computer and on the
web server? The url "/EMSAssist/ClientFunctions.js" referes to a file named
ClientFunctions.js located in the EMSAssist folder on the root of the web
server.
To ensure that the java script file actually is loaded by the browser, add
an alert("Loaded!"); statement to the file.

Anders Norås
http://dotnetjunkies.com/weblog/anoras/
Nov 19 '05 #3

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

Similar topics

7
by: Lynn | last post by:
I'm running Oracle 8.1.7.4.1 on W2K and have the services for my oracle instances set to automatically startup and shutdown with the W2K server. Unfortunately, neither is working. Nothing gets...
0
by: Duane Winner | last post by:
Hello all - I'm having a small problem with the mysql startup script that ships with MySQL-3.23.56-1. I'm running on RedHat Linux. It works fine, but I have a backup server that runs a script...
8
by: John | last post by:
Hi, I'm using mysql-server-3.23.58-4 on a Linux (Fedora 1) machine. After reading the security section of the manual from http://dev.mysql.com, I added passwords for the 'root' accounts. ...
4
by: Jesper | last post by:
Hi, I would like to issue three statements to the database (mysql v4.1) each time the server starts up. Is there any built in way to do this? Like a init file to put them in? At the moment I...
9
by: Harry Smith | last post by:
While reading the documentation on IsStartupScriptRegistered, there is a reference to "client startup script" as "Determines if the client startup script is registered with the Page object." What...
0
by: Stuart Shay | last post by:
Hello All: I am having problem with the getting the Follow JS to run on Startup, the Script gets the client UTC Offset Time it seems the script seems to post back private string...
0
by: Sim Zacks | last post by:
I reconfigured the redhat startup script for postgresql to work with version 8 and that is working fine. I thought I could put autovacuum in the startup script and that didn't cause any problems,...
0
by: Dhanashree | last post by:
I have a RangeValidator which uses AJAX to call server-side validation function from the client. The code works fine, but I have one problem. following is my range validator class: public...
3
by: MrDeej | last post by:
Hello! I am trying to make a startup script which selects a predefined TAB page from a form at startup. This is how i want it to be: I have a table which contains user-data. In this i have a...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
1
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...
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
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,...
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...
1
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...
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...
0
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,...

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.