I’ve been using the twitter-bootstrap navbar class for a while now, and the toggle navbar collapse has been working fine
<div class="navbar navbar-inverse navbar-static-top">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="Home.aspx"></a>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a id="A2" runat="server" href="~/Pages/Home.aspx">Home</a></li>
<li><a id="A3" runat="server" href="~/Pages/Page1.aspx">Page1</a></li>
<li><a id="A4" runat="server" href="~/Pages/Page2.aspx">Page2</a></li>
</ul>
</div>
</div>
And it’s been working until recently where the toggle stopped working on my system alone. It works on other systems i tested it in. JavaScript my browsers (IE and chrome) is enabled. And i can run JavaScript online, just not from my harddisk. I tried a simple JS code and got a black screen
<html>
<body bgcolor=”WHITE”>
<p>Paragraph 1</p>
<script type=”text/javascript”>
document.bgColor = “RED”;
</script>
</body>
</html>
Is there any system setting that stops JavaScript from working on a particular system? Or is something wrong with my code?
2
Answers
Your second example is failing before you are using
RIGHT DOUBLE QUOTATION MARK
instead ofQUOTATION MARK
to delimit you attribute values and JavaScript strings.That makes your Type attribute into a type that the browser doesn’t recognise so it won’t execute the JS. If you fixed the JS then the string delimiters would be invalid so you’d have an error from that.
There isn’t enough information in the first example to tell what the problem is. I wouldn’t be surprised if the URLs to the library files you depended on were wrong (with URLs starting with
//
which maintain the URL scheme (i.e.http
,https
orfile
) and thefile
URL you are using doesn’t exist because the CDN doesn’t live on your local disk).No, there is no such setting. JavaScript is strictly executed within a browser. This is very intentional to set strict limits on what JavaScript can do on a system. The problem is almost certainly tied to your code or your browsers’ ability or inability to load your code.