0

I am kind of new to web development..so not sure if this is possible, I am trying to load a script file from HTML file. Script file is available one folder up than the html

/test/myScript.js

/test/test123/MyPage.html

I am trying to load myscript.js file using following..but its not working. let me know how to proceed further on this.

 <script src="../test/myScript.js" type="text/javascript"></script>

I have an emtpy web project from visual studio, this html file is added there. when i run the solution this file start on IISExpress

asked Feb 4, 2015 at 4:42

1 Answer 1

3

You need to remove test from the path.

Try this.

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

Make sure script file is also added to visual studio project.

HINT : You can also drag script file to the HTML editor in visual studio. It would have created script tag with path for you. Not sure which visual studio you are using but almost all VS support this.

answered Feb 4, 2015 at 4:43
Sign up to request clarification or add additional context in comments.

4 Comments

So Draging that on editor does not work or script tag does not worked?
dragging on editor just opens the file in new window
I think you are doing something wrong. Open html file. Select js file from solution explorer and drag it on html file that you recently opened. I have performed with vs 2013 and it worked correctly for me.
yes..that did work..my script file was outside and i was just dragging it from outside..i included that in vs and then dragged, so it worked.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.