最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Putting Javascript source, then immediately the page not working - Stack Overflow

programmeradmin3浏览0评论

When I put the following code on my page.

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js" />

Then anything below will became nothing, can anyone tell me why?

Thanks alot.

Sorry, I am very new in web development.

Thanks

When I put the following code on my page.

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js" />

Then anything below will became nothing, can anyone tell me why?

Thanks alot.

Sorry, I am very new in web development.

Thanks

Share Improve this question edited Feb 25, 2013 at 23:10 DaveRandom 88.7k11 gold badges158 silver badges173 bronze badges asked Jun 15, 2010 at 13:02 PlayKidPlayKid 8712 gold badges10 silver badges21 bronze badges 1
  • if you missed to read below, it was suggested to not auto close <script> tag... ;) – Reigel Gallarde Commented Jun 15, 2010 at 13:19
Add a comment  | 

7 Answers 7

Reset to default 18

Script tags are not allowed to be auto closed:

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js" ></script>

You cannot close the tag with />. You must do the following:

<script type="text/javascript" src="../../Scripts/jquery-1.4.1.js"></script>

The first thing to check is that the path to the script file is valid and the file exists.

I'm assuming the latter, but as you are specifying a relative path to the scripts folder, make sure that it resolves to the correct location.

Without seeing your directory structure I can't say more.

Use an absolute href for the script rather than a relative href. ASP.Net can be ... picky about href's that go above the level of the VD, and I bet that's what's happening here.

Is that relative src path visible from your page? I'm thinking it's not.

We need more information to fully answer your question.

Check:

1.) The script is within the block.

2.) Your document is well-formed (validates) and has a document type definition.

3.) The script exists.

If still no luck, post back with the entire contents of your xHTML document and the browser in which the problem occurs.

I can guess. You have to close your script file using </script> not simple <script .. /> Try like this. Otherwise some other code base might cause the same problem.

发布评论

评论列表(0)

  1. 暂无评论