IE8 issue with $(".lor1").length; - javascript

I have a code like below where
<script>
document.querySelector("#lor_show").innerHTML = $(".lor1").length;
</script>
lor1 value is from
<div class='lor1' id='unk'><td align='center'><font color='green'><b>UNKNOWN TYPE</b></font></td></div>
results go to
<td align='center' class=\"lor_show\" id=\"lor_show\"></td>
on Chrome everything works good but not in IE8 even when IE8 will work as DOC Mode IE8 Standard mode

Related

Template Engine and Unexpected string constant in IE8 - JavaScript

I've got huge problem when doing HTML compilation with Template Engine build in JavaScript.
Everything is working for Chrome, FF.
IE8 works just in one case - when my HTML is set as variable.
Scenario for HTML:
1). Below example works in all browsers (even in IE8)
var phone_tpl = '<div class="demobile-view">'+
'<div class="heading clearfix">'+
'<span class="attention">{{& attention}}</span>'+
'<h4>aaa</h4>'+
'</div>'+
'</div>';
2). Below example work in CHrome, FF. IE8 won't work with it.
<script type="text/template" id="phone_tpl">
<div class="demobile-view">
<div class="heading clearfix">
<span class="attention">{{& attention}}</span>
<h4>aaa</h4>
</div>
</div>
</script>
Second point in IE8 console responds with error "Unterminated string constant".
I'm attaching full package of library + init example.
http://jsfiddle.net/2trv57rk/
Really believe that someone will be able to help me :) I hate writing HTML in quotes :) I need to have clear, well-coded alternative.
Thank you in advance !!

Double curly brace notation not being compiled

I have the following "Angular HTML"
<div class="radio input-l" ng-repeat="carPark in initialPlace.carParks" ng-show="!carPark.isBlueBadgeCarpark || isBlueBadge">
<input type="radio" name="payment" ng-change="updateParkingSpaces(carPark, initialPlace)" ng-model="initialPlace.selectedCarpark" value="{{carPark.carparkID}}" id="carpark-{{carPark.carparkID}}">
<label for="carpark-{{carPark.carparkID}}">
£{{carPark.cost}} - {{carPark.carparkName}}
</label>
</div>
which renders and works fine in FireFox/Chrome/Safari/[insert another decent browser here]
This is a plunker of what I am trying to do, I can't get plunker (even the root site) working on my MSIE so I have no idea if it behaves correctly, but it really is as simple as this
But in MSIE 7/8 I still seem to get "{{carPark.cost}}" rather than the value
everything else seems to work fine, except the {{ ... }} notations
MSIE 7 Error:
[$sce:iequirks] Strict Contextual Escaping does not support Internet Explorer version < 9 in quirks mode. You can fix this by adding the text to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.
http://errors.angularjs.org/1.2.3/$sce/iequirks
To fix this I just had to add a reference to JSON3.js. For some reason JSON2.js wouldn't work but JSON3 worked fine, I used cdnjs.com for the cdn

Javascript setAttribute in IE9

So I'm trying to make a table hidden when the webpage opens but when a is clicked it should show but I'm having problems with IE9. I read that IE8 and below do not support setAttribute and my webpage seems to work correctly with Firefox. Here is the code, just wondering if anyone could help me out:
<h1 onclick="myFunction()">Show Sitemap</h1>
<table id="myInput" style="visibility:hidden;" width="100%" height="50%">
<tr><td><p>Test</p></td></tr>
</table>
<script>
function myFunction()
{
document.getElementById("myInput").setAttribute("style","visibility:visible;");
};
</script>
Try using
function myFunction()
{
document.getElementById("myInput").style.visibility = "visible";
};
instead, as IE is more compatible with this.
Fiddle:http://jsfiddle.net/E396D/
I tried this in IE10 with compatibility mode on and it worked (the original didn't).

Click a link in HTML using JavaScript

Please help me
I want to use JavaScript to click the LINK on this html code:
<form id="xForm" method="post" action="">
<table>
<tr id="abc">
<td class="goTo" id="goToLINK">
<a class="gotoLINK arrow" href="start.php?from=list&kid=123">LINK</a>
</td>
</tr>
</table>
</form>
document.getElementsByClassName("gotoLINK")[0].click();
MDN reference
It works on all browsers that supports JavaScript and follows the HTML5 spec, including Internet Explorer and Firefox.
However, now it is supported by all elements, as required by HTML5.
document.getElementById('goToLINK').children[0].click()
document.getElementsByClassName("gotoLINK")[0].click();
But remember that this method doesn't work on Firefox (as far as I know) for security questions and its not recommended to use it because it can be annoying to the page guest

Javascript: show hidden stuff in IE7

So I have this in my RoR app, it works in FF, Chrome, and Safari... but not in IE7...
neither li works with or without javascript.
Why does this happen, and how do I fix it?
<li class="decline" name="javascript_required" style="display: none;">
Decline</li>
<noscript>
<li class="decline">
Decline</li>
</noscript>
Then I have this at the bottom
<script type="text/javascript">
hidden_links = document.getElementsByName("javascript_required");
for (i = 0; i < hidden_links.length; i++) {
hidden_links[i].style.display = "block";
}
</script>
Apparently, IE7 doesn't support getElementsByName.
Since I only had 3 things I needed to mess with, I used getElementById...
However.. with getElementById being used all the time would get nasty if there are a lot of things needing to be shown / hidden for whatever reason

Categories