javascript,html,css,internet-explorer-10,conditional-commentsRelated issues-Collection of common programming errors
user3370933
javascript jquery
First, my javascript skills are about zero so this is probably easy peasy :)I have a js carousel with a number of slides and each slide has two divs that you can alter between (show/hide) by clicking on two nav-tabs above (“View” and “Read”), and each slide has these nav-tabs. Everything is working fine except for one annoying detail. Each nav-tab has a dynamic js generated active class to indicate which one is currently active. But the current script targets all nav-tabs on every slide at the s
Jannis
javascript jquery validation arrays
I am trying to write a simple input field validation plugin at the moment (more of a learning exercise really) and thought this would not be too hard, seeing as all I should have to do is:Get input fields Store them in array with each one’s value On submit of form check if array contains any empty stringsBut I seem to fail at writing something that checks for an empty string (read: input with no text inside) inside my array.Here is the code I have so far:var form = $(this), // passed in form ele
nnyby
javascript regex
how do I match this phone number in Javascript?> str “(555) 555-3300” > str.match( ‘/\(555\) 555-3300/gi/’ ) null > str.match( ‘/(555) 555-3300/gi/’ ) nullI bet someone can answer this in 2 seconds. Googling the problem didn’t help me.UpdateAlso tried without the quotes:str.match(/\(555\) 555-3300/gi/) SyntaxError: Unexpected token )Ultimately I’m trying to replace the phone number with a different one.
pita
javascript regex
I am trying to use a javascript regular expression to validate date of birth textbox. here is my codevar patt=/[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}/; alert(patt.test(“1985/08/03”));and the error said: SyntaxEror: Unexpected token {I don’t understand why, this pattern works fine in the asp.net RegularExpressionValidator controller. Many thanks
kotsirokolos
javascript jquery
My script below changes a phrase of the array every 5 sec. It is working on all browsers but not in IE. When I remove the entire lineif (phrases.indexOf(currentPhrase)) phrases.splice(phrases.indexOf(currentPhrase), 1);worked. However this is to test if the currentPhrase is the same with the next phrase. Is there any way of re-writing this ?Thank you.
Lee Taylor
javascript jquery
I’ve got this jquery code, and once I call it the first part of the function initiates, but then right after that the second part initiates; it’s like the if statement isn’t working. Have i got any problems with my code?$(“.pinPane”).click(function() {if ($(‘.pinPane’).hasClass(‘open’)) {var htable = $(‘#content-panel-content’).height();var wtable = $(‘#content-panel-content’).width();var panew = wtable – 2;var paneh = htable * 0.7;var tableh = htable * 0.3;$(‘.pane’).height(paneh).width(panew)
exculuber
javascript html css
<div align=”right” style=”border:1 #FF0 solid; background-color:#999″ onMouseOver=”javascript: function(){this.style.backgroundColor = ‘#DDD’;}” onMouseOut=”javascript: function(){this.style.backgroundColor = ‘#999’;}”> Register </div>When mouseover event triggered it gives this error:Uncaught SyntaxError: Unexpectedtoken (What should I do? I want to define a function inside onMouseOver and onMouseOut
Sebas
php javascript jquery ajax boolean
This question already has an answer here:How to convert string to boolean php6 answerslet’s say we have the following ajax:$.ajax({url:’myURL.php’,data:{ac:’do’,isDoable:false} });Now at the back end when reading the call data, the isDoable is a string, and trying to cast it as Boolean: $isDoable = (bool) $_REQUEST[‘isDoable’];results in $isDoable always being true, even when sent as false. When I encountered this issue I gave up and simply treated it as a string if($_REQUEST[‘isDoable’] == ‘tru
Ian
javascript if-statement ternary-operator control-flow
Suppose I have a code like this:i=1; if(i===1) {i++; }This code does have a if block but no else block. So,my question is , how to accomplish the same thing with the ternary operator. I had tried something like this:i=1; i===1? i++But got an error : SyntaxError: Unexpected end of input.UPDATE:So,now I change my question and ask do ternary operators need an else block in all cases?
bobince
javascript javascript-events
I’m trying to get this Javascript to work properly. My intention is, when a user is trying to close the site page to get an alert saying “stay on current page or close” If they hit ‘ok’ I want it to close, if they hit ‘cancel’ i want it to redirect to another page. The problem is, when they try to go to another page on the same site, it gives them that popup. I want it to show only when closing, not when leaving the page to another page. I’m not sure if that’s possible, I do appreciate your help
codemania
jquery html css facebook
I am seeing some strange behavior when trying to call “facebook like box” with Ajax.The idea is for a user to click a button. Onclick, the facebook plugin will be called with .load() and appear. Onclick again, the content will disappear.The reason for doing this is to cut down on HTTP requests at page load. Is this the best way to achieve such?The code I have written works perfectly with another function calling a weather page. So im thinking it could be something to do with the facebook plugin
exculuber
javascript html css
<div align=”right” style=”border:1 #FF0 solid; background-color:#999″ onMouseOver=”javascript: function(){this.style.backgroundColor = ‘#DDD’;}” onMouseOut=”javascript: function(){this.style.backgroundColor = ‘#999’;}”> Register </div>When mouseover event triggered it gives this error:Uncaught SyntaxError: Unexpectedtoken (What should I do? I want to define a function inside onMouseOver and onMouseOut
dkarv
html css google-chrome
I have a problem with Chrome. I created a website, the html-code looks like that:<div id=”Content”> <h1><span id=”back-color”>Heading</span></h1> <p><span id=”back-color”>bla bla bla:</span></p> <ul id=”bild-liste”> <li><span id=”back-color”><a href=”?section=Bilder&ID=1″>AAAAAA</span></li> <li><span id=”back-color”><a href=”?section=Bilder&ID=2″>BBBBBB</span></li> &l
fedeetz
php html php-5.3
Is it possible to do something equivalent to this in PHP >= 5.3.0?echo sprintf(_(‘By %s’), ?><span class=”author-name”><?php echo $authorName; ?></span> <?php ); ?>If I use said syntax I receive the following error, which is being caused by the first ?>,Parse error: syntax error, unexpected ‘?>’ in …Basically, what I’m trying to do is to insert HTML with PHP tags inside, as a parameter for the sprintf function without treating the HTML as a string (‘<span class
freakish
html css
I have a bit of HTML that looks like this:<div class=”pointwrap”><div class=”imgwrap”><img src=”howtoplay1.jpg” height=”101″ width=”177″/></div><div class=”textwrap”>Tap Anywhere in the Drop zone to release a ball.</div> </div>and my CSS rules for this code look like this:.pointwrap { border-style:solid; border-width:2px; border-color:#2E2E2E; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color:#848484; margin:3px
Kilian Stinson
php html login dreamweaver
Hello so my PHP script is giving me an error with the closing brackets on my if statements the error is as follows this is greatly hindering me and any help would be appreciated thanks.Parse error: syntax error, unexpected T_ELSE on line 40if($numrows !=0) {while ($rows = mysql_fetch_assoc($query)) {$dbusername = $row[‘username’];$dbpassword = $row[‘password’];}if ($username==$dbusername&&$password==dbpassword) {echo “Login Successful. <a href=’homepage.html’>Click Here to go to th
u??o? x??
php html css embedding
I’m a little bit confused right now. I have this code:<?php $this->head( ?><style type=”text/css”>.error {background-color: #ccc;border: 1px solid #999;padding: 10px;width: 500px;}</style> <?php ); ?>I was pretty sure that you could do this. It’s pretty similar to:<?php if (true) { ?>Hei <?php } ?>In fact an error occurs: Parse error: syntax error, unexpected ‘;’, expecting ‘)’ in file.php on line 1 (line 1 of the code)How can i better fix it?
user1334130
php html forms phpmyadmin
I have created a login form that works, so the next step is to return data relative to the user that has logged in rather than the entire table. I am using a php session to parse the username from one file to another. I can echo this value without a problem, however when I try to use it in the following statement, unexpected T_STRING error is thrown. How do I parse the variable correctly.$query = ‘SELECT * FROM table WHERE table.username = $_SESSION[‘user’]’;
ispiro
html css
I’m using CSS as follows:.center {width: 30%;position: absolute;margin-left: auto;margin-right: auto;display: block;height: 100%;text-decoration: none;overflow: hidden;right:0;left:0; }It doesn’t work without the right:0; left:0;(I found that solution in a comment here)Why?
Mark Bubel
php html
This question already has an answer here:Cant make PHP function work inside HTML inside PHP2 answersI can’t make the following work. I know it’s because of the PHP function inside the string of HTML, but I don’t know how to fix it. echo ‘<aside class=”tipContainer”>’.'<div>’.'<h1>’.$header.'</h1>’.'<img src=”<?php bloginfo(‘template_url’); ?>/images/pencil_Tip.gif” alt=””>’.'</div>’.'<p>’.$content.'</p>’.'</aside>’;I receive this error:
codemania
jquery html css facebook
I am seeing some strange behavior when trying to call “facebook like box” with Ajax.The idea is for a user to click a button. Onclick, the facebook plugin will be called with .load() and appear. Onclick again, the content will disappear.The reason for doing this is to cut down on HTTP requests at page load. Is this the best way to achieve such?The code I have written works perfectly with another function calling a weather page. So im thinking it could be something to do with the facebook plugin
exculuber
javascript html css
<div align=”right” style=”border:1 #FF0 solid; background-color:#999″ onMouseOver=”javascript: function(){this.style.backgroundColor = ‘#DDD’;}” onMouseOut=”javascript: function(){this.style.backgroundColor = ‘#999’;}”> Register </div>When mouseover event triggered it gives this error:Uncaught SyntaxError: Unexpectedtoken (What should I do? I want to define a function inside onMouseOver and onMouseOut
dkarv
html css google-chrome
I have a problem with Chrome. I created a website, the html-code looks like that:<div id=”Content”> <h1><span id=”back-color”>Heading</span></h1> <p><span id=”back-color”>bla bla bla:</span></p> <ul id=”bild-liste”> <li><span id=”back-color”><a href=”?section=Bilder&ID=1″>AAAAAA</span></li> <li><span id=”back-color”><a href=”?section=Bilder&ID=2″>BBBBBB</span></li> &l
freakish
html css
I have a bit of HTML that looks like this:<div class=”pointwrap”><div class=”imgwrap”><img src=”howtoplay1.jpg” height=”101″ width=”177″/></div><div class=”textwrap”>Tap Anywhere in the Drop zone to release a ball.</div> </div>and my CSS rules for this code look like this:.pointwrap { border-style:solid; border-width:2px; border-color:#2E2E2E; -webkit-border-radius: 10px; -moz-border-radius: 10px; border-radius: 10px; background-color:#848484; margin:3px
u??o? x??
php html css embedding
I’m a little bit confused right now. I have this code:<?php $this->head( ?><style type=”text/css”>.error {background-color: #ccc;border: 1px solid #999;padding: 10px;width: 500px;}</style> <?php ); ?>I was pretty sure that you could do this. It’s pretty similar to:<?php if (true) { ?>Hei <?php } ?>In fact an error occurs: Parse error: syntax error, unexpected ‘;’, expecting ‘)’ in file.php on line 1 (line 1 of the code)How can i better fix it?
ispiro
html css
I’m using CSS as follows:.center {width: 30%;position: absolute;margin-left: auto;margin-right: auto;display: block;height: 100%;text-decoration: none;overflow: hidden;right:0;left:0; }It doesn’t work without the right:0; left:0;(I found that solution in a comment here)Why?
user2247326
php css html5 codeigniter zend-framework2
I always have this error:Parse error: syntax error, unexpected T_STRING in /home/user/public_html/nameofsite/application/libraries/Zend/Barcode/Barcode.php on line 10Here is my controller code for generating barcode:public function testbarcode() {require_once(‘./application/libraries/Zend/Barcode/Barcode.php’);//adjust the above path to the correct location$barcodeOptions = array(‘text’ => ‘ZEND-FRAMEWORK’);$rendererOptions = array();Zend_Barcode::factory(‘code39’, ‘image’, $barcodeOptions, $
Bob Desaunois
jquery css margins
I’ve got the following problem. I want an interval to change the marginLeft of an element every 1 second through jQuery. but this has to be the innerWidth of the window class divided by 4.I have done it as following;$(document).ready(function() { var adjust = setInterval(function() {$(“.content”).css(“marginLeft” : window.innerWidth / 4); }, 1000); });However the console just spits out the following error;Uncaught SyntaxError: Unexpected identifier How would you do this to make this work?Thanks
Farzad Bayan
html ios css
It’s my button:<div id=”body”><button>Hello</button> </div>and its style:#body{width:400px;margin:0 auto;background:#eee;border:1px solid #ccc; } button {display: block;margin: 0 auto; }It’s centered, but let’s see the result in ipad:It shifts to left.Take a look at this case: http://jsfiddle.net/c2HLe/9/Note. This is similar to my previous question, but in this case I made it with a simple structure, so I think people can focus better on the problem.
LoganEtherton
html css twitter-bootstrap
Having created a simple registration form using Twitter Bootstrap for the UI, I find that I’ve run into an unexpected problem. You see, some of the form rows are clickable, whereas some of them are not. However, you can tab over to all of the rows and enter information, which then writes correctly to the database. So, my guess is that it’s a CSS problem. I haven’t written any JavaScript that should cause this problem.Anyone have any ideas? The page can be found here:http://loganswalk.com/efc/efc
Dirk
c# selenium internet internet-explorer-10 ui-automation
I tried the code below a 100 times and still get this error:Unexpected error launching Internet Explorer. Could not get document from window handle (NoSuchDriver)Not much on this error except the Protected Zone sync which is worthless.InternetExplorerOptions options = new InternetExplorerOptions(); options.IntroduceInstabilityByIgnoringProtectedModeSettings = true; IWebDriver driver = new InternetExplorerDriver(pathContainingIEDriverServer, options);driver.Navigate().GoToUrl(“http://www.google.c
Jonathan Sampson
html doctype internet-explorer-10
I have an application which works fine on IE8 and IE9. But the same application throws errors similar to the following on IE10. Any one knows what changed in IE10 that can trigger this issue?HTML1502: Unexpected DOCTYPE. Only one DOCTYPE is allowed and it must occur before any elements.HTML1513: Extra “<html>” tag found. Only one “<html>” tag should exist per document.In my application I have a set of main jsp which included other jsps on a need basis. Each jsp has a and tag in i
giammin
c# asp.net iis internet-explorer-10
I’m migrating one of our website to new server, running Windows Server 2008 R2 and IIS 7.Web is perfectly running under Google Chrome, but there is something weird while using IE 10.Example in Google Chrome (which is OK):Entering www.ourweb.com/Login.aspx Logging in Redirected to www.ourweb.com/Home.aspxExample in IE 10:Entering www.ourweb.com/Login.aspx Logging in Redirected to www.ourweb.com/(F(UTq2wZuGLRl0BKou8K0HshpBua96yAkY81e7lJOeUvuhO5Njmsh1cHhPeiJkO7tnPBj7xxUI6zy1XVkX_BfV5vMJiKlNz76kd1dW
phun-ky
cookies internet-explorer-10
I’m struggling with IE 10 and document.cookie, and this behaviour is for me unexpected..If I use this code in the developer console in IE 10document.cookie=”withactualpathanddomain=nb; path=/pathname/; domain=localhost”; document.cookie=”withactualpath=nb; path=/pathname/;”; document.cookie=”withpathanddomain=nb; path=/; domain=localhost”; document.cookie=”withdomain=nb; domain=localhost”; document.cookie=”justname=nb;”;The browser only sets two cookies: “justname” and “withactualpath”.If I do t
jon3laze
windows-server-2008 iis7 http-error-401.2 internet-explorer-10
I am not sure if this is more of a coding issue or server setup issue so I’ve posted it on stackoverflow and here…On our production site we’ve run into an issue that is specific to Internet Explorer 10.I am using jQuery doing an ajax POST to a web service on the same domain and in IE10 I am getting a 401 response, IE9 works perfectly fine. I should mention that we have mirrored code in another area of our site and it works perfectly fine in IE10. The only difference between the two areas is th
balpha
javascript internet-explorer-10 requestanimationframe
So I’ve been a good net citizen, using feature detection to see whether the browser supports requestAnimationFrame and only fall back to a setTimeout-based solution otherwise (something around the lines of Paul Irish’s famous post).var NOW = Date.now || function () { return new Date.getTime(); }; var reqAnimFrame =window.requestAnimationFrame ||window.webkitRequestAnimationFrame ||/* … || */function (callback) {setTimeout(function () { callback(NOW())
Konstantin D – Infragistics
javascript windows-8 microsoft-metro winjs internet-explorer-10
I’ve started playing with Windows 8 recently, and (as a web developer) I’m using JavaScript to build my Metro-style app.I’ve learned how to use the debugging tools in VS Express 2012… but it occurs to me that the wrapping WebView (or whatever it’s called) could simply be a stripped-down IE10. I’ve never heard an explanation for what the HTML/JS engine is in this environment. Does anyone know what is happening under the hood?
user1470516
actionscript-3 flash internet-explorer-10 usb-drive
I’m running a website from a USB drive and trying to pass parameters through the address bar to a new window when a button is clicked in the embedded flash swf.The problem is that on some workstations the parameters are stripped from the URL. On others it works fine.I have a movieclip button that when clicked calls this function:function onReleaseHandler(myEvent:MouseEvent) { var printURL = “html/certPopup.html”;var request:URLRequest = new URLRequest(printURL);var variables:URLVariables = n
DJDavid98
javascript jquery html internet-explorer-10 pinned-site
Currently, my page contains the following meta tags in the <head>:<meta name=”application-name” content=”MLP Now” /> <meta name=”msapplication-starturl” content=”./” /> <meta name=”msapplication-navbutton-color” content=”#C693FB”/> <meta name=”msapplication-tooltip” content=”MLP Now” />This works just fine, and the browser happily updates the button color to match the set value. But here’s the catch, this only happens when the page is reloaded.I don’t want to force
robocat
javascript scrolling internet-explorer-9 mousewheel internet-explorer-10
I know it’s possible to detect up and down e.g.function handle(delta) {if (delta < 0) {alert(‘down’); } else {alert(‘up’);} }function wheel(event){var delta = 0;if (!event) event = window.event;if (event.wheelDelta) {delta = event.wheelDelta/120; } else if (event.detail) {delta = -event.detail/3;}if (delta)handle(delta);if (event.preventDefault)event.preventDefault();event.returnValue = false; }/* Initialization code. */ if (window.addEventListener)window.addEventListener(‘DOMMouseScroll’, wh
rds
javascript internet-explorer browser-detection conditional-comments
In order to detect IE most Javascript libaries do all sort of tricks.jQuery seem to add a temporary object into your pages’s DOM to detect some features, YUI2 does regex on the user agent in its YAHOO.env.ua = function() (file yahoo.js)After reading this answer it came in my mind that it’s true, in order to detect simply IE in Javascript we could simply add to our pages:<!–[if IE]><script type=”text/javascript”>window[‘isIE’] = true;</script><![endif]–><script type=”
Peter Mortensen
javascript html css internet-explorer-10 conditional-comments
How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?I tried this, but it doesn’t work:<!–[if IE 10]> <html class=”no-js ie10″ lang=”en”> <![endif]–> <!–[if !IE]><!–> <html lang=”en” class=”no-js”> <!–<![endif]–>Internet Explorer 10 ignores the conditional comments and uses the <html lang=”en” class=”no-js”> instead of <html class=”no-j
Web site is in building