I have a standard PHP/Smarty Website. There is a home base with index.php, a templates folder with the .tpl Files. I have a header.tpl, footer.tpl, index.tpl and subpage.tpl.
The index.tpl and subpage.tpl both include the header.tpl. I know they are both have the header.tpl included correctly because css is the same on both pages. In the head tag on the header.tpl I have a jQuery autocomplete script. If I have the text box on the index.tpl the autocomplete works.
If I place the same input text box code on the subpage The Autocomplete does not work. I force compile smarty, removed all cache and can't seem to figure out why? Any Ideas?
My Header .tpl
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html lang="en"> <!--<![endif]-->
<head>
... my css
<!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" type="text/css" href="scripts/jquery.autocomplete.css" />
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/jquery.autocomplete.js"></script>
<script type="text/javascript" src="scripts/onchange.min.js"></script>
<script>
$(document).ready(function(){
$("#Part_Number").autocomplete("autocomplete/parts.php", {
selectFirst: true
});
});
</script>
my index.tpl and subpage.tpl
{include file="header.tpl" page="Home"}
<input type="text" id="Part_Number" name="Part_Number"></input>
The only thing that can be different in your 2 pages are the URI you are calling:
$("#Part_Number").autocomplete("autocomplete/parts.php", {
try to put an absolute path like this:
$("#Part_Number").autocomplete("http://www.example.com/autocomplete/parts.php", {
Related
I've been trying to get this work in my angular project, searching over the internet and it seems none of the possibles answers are helping me.
My console says:
Scripts may close only the windows that were opened by it.
Because I'm trying to close my current window with a button.
<button onclick="window.close();">Close window</button>
and of course the reasons is described at the console message. I can not close this window because this was not opened by javascript. At the first time my close window button was inside a ng-view and didn't work, after that I've moved my button to my index page outside the ng-view getting the same result :(
After those changes and other more that I've been found on internet, I've created a project from scratch, simple app, basically working just with the ng-app on index.html and a couple of controller that do nothing. AND this button works.
This works:
<!DOCTYPE html>
<html ng-app="myApp">
<head lang="en">
</head>
<body ng-controller="MyController">
<button onclick="window.close();">Close window</button>
</body>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script>
<script src="MyControllers.js"></script>
</html>
This is not working:
<!DOCTYPE html>
<!--[if lt IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html lang="en" ng-app="myApp" class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html lang="en" ng-app="myApp" class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!-->
<html lang="en" ng-app="myApp" class="no-js">
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>my web</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<my-nav-bar></my-nav-bar>
<div ng-view></div>
<button onclick="window.close();">Close window</button>
<script src="libs/jquery.js"></script>
<script src="libs/angular.js"></script>
<script src="libs/myapp/myapp.js"></script>
<script src="libs/myapp/mycontroller.js"></script>
<script src="libs/myapp/mydirectives.js"></script>
</body>
</html>
It says scripts may close only the windows that were opened by javascript but can anyone makes me notice if there any diference between this two html? if it's not, How the first html is following this rule and the second one doesn't'?
Bootstrap 3 is not working or broken on Win 7 IE Version - 8.0.7600.16385
URL : http://getbootstrap.com/
It seems the respond.js or html5shiv is not working on this specific version of IE 8. But its working fine on IE v8.0.7601 and IE v8.0.6001 (Via Sauce labs)
Here is the HTML (head part) All files are on correct path.
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="ie ie6 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 7]> <html class="ie ie7 lte9 lte8 lte7"> <![endif]-->
<!--[if IE 8]> <html class="ie ie8 lte9 lte8"> <![endif]-->
<!--[if IE 9]> <html class="ie ie9 lte9"> <![endif]-->
<!--[if gt IE 9]> <html> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>OHH Web App</title>
<!-- Bootstrap -->
<link href="media/css/bootstrap.css" rel="stylesheet">
<!-- Structure: Global -->
<link href="media/css/global.css" rel="stylesheet">
<!-- Modernizr (Should be on Head)-->
<script type="text/javascript" src="js/modernizr.js"></script>
<!-- HTML5 Shiv and Respond.js IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script type="text/javascript" src="js/html5.js"></script>
<script type="text/javascript" src="js/respond.js"></script>
<![endif]-->
</head>
Any Idea how to fix this? or is this a known bug in this version? Thanks for your help
Attached screenshot.
HTML5.js only wokr on server side, but sometimes its get problem with some other scripts. please check your CSS properties, and if that does not help. try add manually some script to force html5 elements, like this
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<!--[if lt IE 8]>
var e = ("abbr,article,aside,audio,canvas,datalist,details,
figure,footer,header,hgroup,mark,menu,meter,nav,output,
progress,section,time,video,figcaption,summary").split(',');
for (var i = 0; i < e.length; i++){
document.createElement(e[i]);
}
<![endif]-->
Please check does evrything works in ie8, and check any error logs, maybe some script is forcing the problem.If you are didint sure about your css, please check this
http://css3pie.com/
It can help you a lot properly write your css for older browsers
thanks for reading.
I have a simple problem that i can't solve. I just need to have a html map with Jquery fadeIn and fadeOut effects. I got it and it works everywhere except with IE8.
So i just wanna add a pure javascript already tested and working just when IE8 is present.
Obviously i tried writing this code but is not working even with a simple alert after the IE comment.
Can you help please?
Here's the code, thanks!
<script type="text/javascript">var runFancy = true;</script>
<!--[if IE]>
<script type="text/javascript">
runFancy = false;
alert(runFancy);
function showIt(name)
{
document.getElementById('map_image').src='immagini/distributori/8/'.concat(name).concat('.png');
document.getElementById('map_image').style.display='block';
}
function hideIt()
{
document.getElementById('map_image').src='immagini/distributori/8/map.png';
};
</script>
<![endif]-->
Here's the code for other browsers
<!--[if !IE]><!-->
<script type="text/javascript">
//alert('hi'); not working even just this
if (runFancy) {
function showIt(name)
{
document.getElementById('map_image').src='immagini/distributori/single/'.concat(name).concat('_single.png');
$('#mapon').fadeIn(400);
}
function hideIt()
{
$('#mapon').fadeOut(300);
};
}
</script>
<!--<![endif]-->
even this is not working, any advice?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
</head>
<body style="background-color:red">
<h1>Ciao</h1>
<!--[if IE]>
<style language="text/css">
body{background-color:black;}
</style>
<![endif]-->
</body>
</html>
not working with every IE version.
This will help you:
HTML:
<!doctype html>
<!--[if IE]><![endif]-->
<!--[if lt IE 7 ]> <html lang="en" class="ie6"> <![endif]-->
<!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--><html lang="en"><!--<![endif]-->
<head></head>
<body></body>
</html>
Javascript:
<!--[if IE 8]>
<script type="text/javascript" src="IE8.js">
<![endif]-->
the code you have should be working but if you want to target just IE 8 put IE 8 instead of just IE like so
<!--[if IE 8]>
do stuff
<![endif]-->
edit: removed depreciated jquery solution
ok i have this code (which i got from paul irish page+ some modifications) (it gives you your ie version (standar stuff):
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
</head>
<body>
<h1>test:</h1>
<script type="text/javascript">
$(function test()) {
"use strict";
// Detecting IE
var oldIE
if ($('html').is('.ie6, .ie7, .ie8')) {
oldIE = true;
}
if (oldIE) == true {
document.write("version<ie9")
} else {
document.write(" version => ie9")
}
}
</script>
<script type="text/javascript">
<button type="button" onclick="test()">testing</button>
</script>
</body>
</html>
the thing is it isnt showing the testing button
The <button> element should not be surrounded by <script> tags. After all, it's HTML, not JavaScript.
<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
<title>A HTML document needs a title to be valid.</title>
</head>
<body>
<button id="test">I feel so clickable today.</button>
<!-- You must include jQuery before you can use its methods -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript">
"use strict";
(function ($) {
// Assignment with the ternary operator
var oldIE = ($('html').is('.ie6, .ie7, .ie8')) ? true : false;
// You need at least jQuery 1.7 to use .on()
$('#test').on('click', function() {
console.log(oldIE);
});
}(jQuery));
</script>
</body>
</html>
N.B. I included jQuery because I saw a $ symbol in your code.
Since you should be using the console during development, here's a snippet that safeguards against JS errors in browsers that don't provide a console.
// Avoid `console` errors in browsers that lack a console
(function(){var e;var t=function(){};var n=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"];var r=n.length;var i=window.console=window.console||{};while(r--){e=n[r];if(!i[e]){i[e]=t}}})();
But if you wanted to keep it in the script tag you would need to modify your code like so:
<script type="text/javascript">
document.write('<button type="button" onclick="test()">testing</button>');
</script>
I have been implementing Routing in my app following the tutorial
http://docs.angularjs.org/tutorial/step_07
I couldn't get my version to work in IE7, and after spending a while trying to work out what I have missed / done wrong I have noticed that the example doesn't work.
http://angular.github.com/angular-phonecat/step-7/app/
Anyone know how to get this to work?
OK I had the same problem so I started the bounty, but after that I found the working solution (for me at least):
Use HTML5 shim
Use JSON2.js
Add all these attributes to your html node:
class="ng-app:myapp" id="ng-app" ng-app="myapp" xmlns:ng="http://angularjs.org"
(where myapp is really your app name)
So to recap, here is my IE7/8/9 working HTML page:
<!DOCTYPE html>
<html lang="en" class="ng-app:myapp" id="ng-app" ng-app="myapp" xmlns:ng="http://angularjs.org">
<head>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!--[if lte IE 8]>
<script>
document.createElement('ng-include');
document.createElement('ng-pluralize');
document.createElement('ng-view');
document.createElement('ng:include');
document.createElement('ng:pluralize');
document.createElement('ng:view');
</script>
<![endif]-->
<!--[if lt IE 8]>
<script src="js/json2.js"></script>
<![endif]-->
</head>
<body>
<div ng-view></div>
</body>
</html>