Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811297
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:06:30+00:00 2026-06-02T04:06:30+00:00

I put a function in an existing.js file (I tried two different files) so

  • 0

I put a function in an existing.js file (I tried two different files) so that the method would be available multiple places without repeating the code. I even created a simple function just to make sure it wasn’t something my function was messing up.

function doNothing() {
    alert("Dammit."); 
}

I can see the method in the intellisense list in my .ascx control, but as soon as I try to step into it, it fails.

Below is how I tried to reference the file and it seemed to work as far as seeing the methods, but it won’t work.

<script src="/javascript/messages.js" language="javascript" type="text/javascript"></script>

Any ideas? Any common mistakes that I may be making? It looks like it should work.

Note: when the methods are inside the .ascx file, they work fine, even with missing semi-colons.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:06:35+00:00Added an answer on June 2, 2026 at 4:06 am

    Even if IntelliSense suggested "/javascript/messages.js", the path will be wrong if your application is installed under a virtual directory instead of at the root of the Web site. For example, the full URL of the JavaScript file might be at http://www.example.com/myapp/javascript/messages.js, but because the src attribute starts with a /, the browser will access http://www.example.com/javascript/messages.js (without the “myapp” virtual directory) instead.

    If you’re using WebForms, you can change the src attribute as follows:

    src='<%= this.Page.ResolveClientUrl("~/javascript/messages.js") %>'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two asp.net textboxes and need to put a validate function in javascript
I need to put a one second delay in this jQuery function so that
What would i need to put in the SortIP function to make the custom
I have a php application that has about 50-55 code files. The file that
I want to define a macro that can be invoked in different places (at
When I make a growing file in php, I usually use the _file_put_contents_ function
I can put python doctests in the bodies of each function, which I sometimes
Up until now I just put all my jQuery goodness inside the $(document).ready() function,
Basically I'm Trying to put out on the Textbox inside the Shared Function, But
I am using the jQuery $.ajax() function. I have put this into a parent

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.