Putting Javascript source, then immediately the page not working
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
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.
精彩评论