Results 1 to 5 of 5

Thread: src problem with js file.

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    src problem with js file.

    hi all
    i have asp page in which i have some j.s functions. in order to clean up the mass in the file i want to copy those functions to js file which name will be default.js the file will be in the new folder which name is js. when i try to write the folowing code

    <HEAD>
    <link rel="stylesheet" type="text/css" ref="css/MenueStyle.css">
    <script language="JavaScript" src="../js/default.js"></script>
    </head>

    in the asp file i got error msg. but when i cut the js finctions again into the default.asp file the functions work all write again.
    did i miss something!!!????

    pleasssssssssssssse help me!!!!!

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    If you are not trying to access the scripts directly in the ASP file, it should work just fine. What does the error say?

    Possible the relative path is incorrect to the js file? Maybe not enough "../" or to many? Try placing the exact path for the source and see it works.

    On the other hand, if you are needing the ASP script to access the function contained in the js file then you can not do that in that way. The the ASP will be processed first and then the HTML.

    As long as you're processing as JS and not VBS you can include the file like this:

    <!-- #include virtual="../js/default.js" -->

    Then the ASP script would have access to that file as long as the above line is placed before the calling procedures.

    Let me know if this does not answer your question.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    Unhappy src problem - still doesnt work

    thnks for reply me!!!! i attach the 2 files default.asp and default.js which make me the problems. i have tried to type the whole path and it still doesnt work.
    notice the default.asp line 22 - there i wrote the linkage.
    regards
    Ron
    Attached Files Attached Files

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2003
    Posts
    175

    src

    i have forgit to tell you that
    default.asp
    is locataed
    C:\Inetpub\wwwroot\AlexProject\default.asp

    and default.js is located in

    C:\Inetpub\wwwroot\AlexProject\js\default.js

  5. #5
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    At a quick glance, this might be the problem.

    On line 22 you have:
    <script language="JavaScript" src="../js/defaulr.js"></script>

    default is misspelled. It should read:
    <script language="JavaScript" src="../js/default.js"></script>

    See if that change works. I'm having issues with my server right
    now so I can't load up the asp page right now to test. If that
    doesn't work, I'll look a little more.

    Another Issue/Possibility
    I may be wrong, but I don't think you can use the ASP in your JS
    file the way you are trying to in the CreateMail function
    because the server doesn't know to process the ASP script in the
    JS file. I think you'll have to pass the UserName value as a
    parameter to CreateMail instead. It's a rather simple change -

    You can write the initial HTML line read:
    Code:
    <a href="javascript:createMail(<% =session("UserName") %>);">
    And just change the js function to read:
    Code:
    function createMail(sUserName)
    {
    window.open("new_message.asp?un=" + sUserName + "&page="+document.main.location,"Messeges", "height=270, width=520, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=yes");
    }
    Last edited by RealisticGraphics; Jul 17th, 2003 at 06:02 PM.
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width