php,javascript,jquery,html,cssRelated issues-Collection of common programming errors
waiwai933
php exception exception-handling throw
I’m trying to use exceptions in PHP as a way of avoiding multiple if-then-else blocks. However, when I try to catch the exception, I get the error Parse error: syntax error, unexpected T_CATCH in /directory/functions.php on line 66. Am I doing something wrong with my throwing and catching?function doThis($sSchool, $sDivision, $sClass, $sUsername, $sCode,$query1,$query2) {connectDb();global $dbConnection;$sDivisionIdArray = mysqli_query($dbConnection,$query1);if ($sDivisionIdArray==false){throw n
Galen
php mvc
i know that everything is going through the controller.but i often read articles that says something like this:user interacts with the view controller asks the model to change its state model notifies the view when its sate has changedi dont get the 3rd one. why saying that the model notifies the view, when it actually is notifying the controller and the controller is notifying the view?
Phil Jackson
php upload
Im using BluImp file uploader. Greate little script that I’ve used forever.Now I have scoured there forum and cant find anything but after debugging, I believe it is more of a permissions/restrictions/settings problem.Once the upload has appeared to have finished, an error is returned:Error: SyntaxError: Unexpected end of inputAfter debugging it is cause by any functions writing to the server, i.e. file_put_contents, move_upload_file….The file is 1.47 mbmy additional ini alterations are max_ex
maxgee
php html mysql table variables
I am trying to get this data to go into a table so I can view it better on my website and I dont really understand how to combing PHP and HTML and I was getting this error Parse error: syntax error, unexpected ‘;’ I dont know if I combine them wrong so here is my code and tell me if I need to supply more than this line of code. <h2>Featured Event’s</h2> <body> <table cellpadding=”10″> <tbody> <?php echo ?><td><?php $eventname ?></td><?php
Bojangles
php mysql jquery-ui
This seemed simply but i’m running into a problem. I’m building an autocomplete drop down box using jquery ui. It works fine with static information but when i try put dynamic data from mysql in the array it freaks out.Parse error: syntax error, unexpected T_DO, expecting ‘)’ on line 46Line 46 is the do in the array$items = array(do { $row_Recordset1[‘ARTIST’]; } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); );I’ve searched the net but I can’t find anything relating to problems w
ZyteX
php html compiler-errors echo
I have a long HTML code which I’m echoing out through the echo code. However I get an error and if I remove the code on all the lines where it says there’s an error I get an error on the body instead. When I try to connect to my page I get this error: ( ! ) Parse error: syntax error, unexpected $end inC:\wamp\www\Legendary\new\usersettings.php on line 670http://fiddle.jshell.net/n4a6W/** EDIT ** I just noticed one of the errors, but the errors with almost all of the is still there…
teresko
php yii optional-parameters yii-cmodel
I am trying to modify 1 controller to work with 2 models. This is what I have done with loadModel function in my controllerpublic function loadModel($id, $_model) {if (isset($_model)){$model=$_model::model()->findByPk($id); // syntax error, unexpected “::”if($model===null)throw new CHttpException(404,’The requested page does not exist.’);return $model;} else {$model=Foods::model()->findByPk($id);if($model===null)throw new CHttpException(404,’The requested page does not exist.’);return $mod
JDelage
php ajax json
All,I’m trying to pass a stringified json object as a GET parameter but the receiving URL seems unable to decode it, I am not sure why.Here is the relevant code:Client side Json object production (works fine): function createJson(){ // This works fine. It creates a json objects with three elements, the third being an array. //(omitted code for brevity)return jsonData; }Client side ajax call (works fine):function recordSetGet(jsonData){request = createRequest();var rawSet=JSON.stringify(jsonDat
Colin
php parsing
I’ve finally started to learn PHP and I quite have trouble with it. I am trying to make a website change its stylesheet according to the moment of the day (day, twilight, night) and I’ve taken this approach:<?php$lt = localtime();if ($lt[2]>=6 && $lt[2]<=16)echo(‘<link href=”style.css” rel=”stylesheet” type=”text/css” />’);elsif ($lt[2]>=17 && $lt[2]<=21)echo(‘<link href=”style_twilight.css” rel=”stylesheet” type=”text/css” />’);elseecho(‘<link href=
psniffer
php versions
i wrote a small program to help me study, it works fine on the localhost, but when i upload it i get an error message that has me stumped the line i get the error with is below<?php echo “Num # : ” . ($_SESSION[‘monster’]->getQuestionNumber()[$q]) .” of ”. $_SESSION[‘monster’] -> getTotalQuestions() . “<BR>”;?>on the local host i have PHP Version 5.4.4-14+deb7u5on the remote server i have PHP Version 5.2.6the error i get is Parse error: syntax error, unexpected
ProfK
asp.net javascript jquery
I’m trying to call a Page Method using a jQuery ‘attached’ event function, in which I like to use the closure to keep the event target local, as below, but page method calls declare several ‘error’ functions, and I would like to use one function for all of them. If, in the below code, I was handling an error and not success, how could I use my single, anonymous handler for all 3 error functions?$(“:button”).click(function () {var button = this;PageMethods.DoIt(function (a, b, c) {alert(button);
BlairHippo
javascript
I’m trying to change the value of a text input field based on user actions. I’m doing it like this:document.getElementById(textFieldID).value = newValue;It isn’t quite working — the original text in the field remains on the screen, unchanged. However, when I submit the form, it behaves as though the value was indeed changed correctly. (And a debug alert confirms that yup, I’m hitting that bit of the code and passing in the right field ID and text value.) Anybody have any insights? Is there
Jürgen Thelen
javascript jquery javascript-events
The below code works well on localhost using XAMPP. But it doesn’t work on another server.<!DOCTYPE html> <html><head><script src=”jquery-latest.js”></script></head><body>word: <input type=”text” id=”sub” />user: <input type=”text” id=”user” /><button type=”button” id=”btn”>Click Me!</button><script>$(“#btn”).click(function () {var word=$(“#sub”).val();var usr=$(“#user”).val();alert(“hi”);});</script></body> <
Ketema
javascript syntax coffeescript
I have the following valid javascript:App.Person = DS.Model.extend({ firstName: DS.attr(‘string’), lastName: DS.attr(‘string’), birthday: DS.attr(‘date’),fullName: function() {return this.get(‘firstName’) + ‘ ‘ + this.get(‘lastName’);}.property(‘firstName’, ‘lastName’) });According to js2coffee.org This js is the equivalent of the following coffee script :App.Person = DS.Model.extend(firstName: DS.attr(“string”)lastName: DS.attr(“string”)birthday: DS.attr(“date”)fullName: ->@get(“firstName”)
mu is too short
javascript coffeescript
This is my coffee, I simply can’t see why this is wrong. I keep getting an unexpected , error. renderTable:()=>@table = d3.select(“#search-results-area”).append(“table”).attr(“id”,@tableId).attr(“class”,”visualization-panel”)@thead = @table.append(“thead”)@tbody = @table.append(“tbody”)@input = @table.append(“input”).attr(“id”,@inputId).on(“keydown”,(d)=>console.log(“keydown”)console.log toFilter = $(@input[0][0]).val() window.setTimeout(()=> toFilter = $(@input[0][0]).val() @tbody.sele
dopatraman
javascript regex
I’m using a the .replace() method in javascript to convert a serialized array of objects into a simpler serialzed string. Here is my code:b = //string b = b.replace(/},{/gi, “},cb,,{“); b = b.replace(/}],[{/gi, “},cb,,row,{“); //The error is being thrown for this lineWhen I run this code I am getting an “Unexpected Token /” error for the third line. Why is this? The line is more or less identical to the line above it. Please help me figure this out.Note: I cant submit a string without the regex
Pointy
javascript
var bookmark_iterator = page_element.firstChild; do {// start insertionif (bookmark_iterator === null) {page_element.appendChild(div_el);break;}// middle insertionif (div_el.id < bookmark_iterator.id) {page_element.insertBefore(div_el, bookmark_iterator);break;}// end insertionif (bookmark_iterator === page_element.lastChild) {// if null will insert at the end per referencebookmark_iterator = null;page_element.insertBefore(div_el, bookmark_iterator);break;}// increment loopbookmark_iterator =
jlleblanc
javascript html ajax mootools
I’m trying to build some JavaScript in MooTools that fetches table row markup from the server, then adds it to a table. I have an object named htmlAjax that’s set as a MooTools Ajax object. The object gets the HTML from the server correctly (tested this in the Firebug console), but when I attempt to add this markup to a new element, the <td> elements get stripped out. Here is my function that captures the data from the HTTP request and attempts to add a row:htmlAjax.addEvent(‘onComplete’,
cspray
javascript div
I’m pretty new to javascript and programming and have run into a brick wall with my project. I have a div which contains the javascript to embed a quicktime player, when the page is first loaded no .mov file is pointed at by the page so a placeholder div is ‘unhidden’ and the player div is set to style.display = ‘none’.So far so good, the user then enters the name of the new movie, the placeholder div is hidden and the player div is unhidden. My problem is that the javascript in the player div d
user3057928
javascript
var cashRegister = {total:0,add: function(itemCost){total += this.itemCost;},scan: function(item) {switch (item) { case “eggs”: this.add(0.98); break;case “magazine”:this.add(4.99);break;}return true;} };cashRegister.scan(“eggs”); cashRegister.scan(“magazines”);console.log(‘Your bill is ‘+cashRegister.total);the output show NAN, and total is undefined. I tried cashRegister.total and this.total in the add method, no luck. What’s wrong with the code above?
ProfK
asp.net javascript jquery
I’m trying to call a Page Method using a jQuery ‘attached’ event function, in which I like to use the closure to keep the event target local, as below, but page method calls declare several ‘error’ functions, and I would like to use one function for all of them. If, in the below code, I was handling an error and not success, how could I use my single, anonymous handler for all 3 error functions?$(“:button”).click(function () {var button = this;PageMethods.DoIt(function (a, b, c) {alert(button);
Vikdor
jquery html
in my html header i have <head><script src=”jquary.js”></script><script>$(document).ready(function(){ladda();});</script></head>and i load jquaryand in the body i have<form namne=”load”<fieldset><legend> load</legend><table><tr><td><div id=”innehåll1″>vill du ändra denna text</div></td></tr></table> <button id=”load_text”>ändra</button> </fieldset>and in my javascript i have
Jürgen Thelen
javascript jquery javascript-events
The below code works well on localhost using XAMPP. But it doesn’t work on another server.<!DOCTYPE html> <html><head><script src=”jquery-latest.js”></script></head><body>word: <input type=”text” id=”sub” />user: <input type=”text” id=”user” /><button type=”button” id=”btn”>Click Me!</button><script>$(“#btn”).click(function () {var word=$(“#sub”).val();var usr=$(“#user”).val();alert(“hi”);});</script></body> <
j08691
jquery
Hi guys I am trying to make my slider picking dynamically changed width of the window and put the right variable “newscount” to “slidesPerSlide : window.newscount” plus reload the last part:swiperLoop = $(‘.swiper-loop’).swiper({slidesPerSlide : window.newscount,loop:false }); Please help me, the code is below:$(window).on(‘load’, function(){$(window).on(‘resize’, function() {var w = $(window).width();if (w < 321) {var newscount = “2”;}else if (w < 480) {var newscount = “3”;}else if (w <
Cristiano Marques
jquery each
For some reason its only finding one div instead of finding all divs with that id.JS:jQuery(‘#showoffline’).click(function(){jQuery.each(jQuery(‘#offlineestreams’),function(){jQuery(this).css(“display”,”block”);}); });Divs are something like this:<div id=”offlineestreams” style=”display = none;”> Something here </div> <div id=”offlineestreams” style=”display = none;”> Something here2 </div>But only the first one shows :\ Why is that happening?
user2341213
php jquery alert
My JQuery code is not working. I tried functions such as “mouseenter” and that didn’t work, so I simply tried this and the alert does not show up. Is it a problem with the syntax or possibly something I am missing?<script type=”text/javascript” src=”jquery-2.0.0.min.js”></script> <link type=”text/css” rel=”stylesheet” href=”stylesheet.css”/> <script type=”text/javascript” src=”script.js”></script>The JS is this:$(document).ready(function() {alert(“JQuery is working!
Will
jquery
What are some quick tips for increasing jQuery performance?
tkone
jquery ajax json jquery-ajax
I have the following code:$.ajax({type: ‘get’,mode: ‘abort’,dataType: ‘json’,url: ‘http://localhost/1.php’,data: {},success: function(res){alert(res);},timeout: 10000,error: function(XMLHttpRequest, textStatus, errorThrown){alert(“ERROR L: ” + textStatus + ” (” + errorThrown + “)”);}});PHP contains only {id:1} and that’s it. When I try to parse the code as is, I get:ERROR L: parsererror (SyntaxError: Unexpected token i)from the error handler I have. If I change to dataType:’html’, Everything
Awea
jquery cross-browser
I have a form : <form accept-charset=”UTF-8″ action=”/back/pages/22?locale=fr” class=”form-horizontal page-form” enctype=”multipart/form-data” id=”edit_page_22″ method=”post” target=”_blank”><div style=”margin:0;padding:0;display:inline”><input name=”utf8″ type=”hidden” value=”?”><p><a href=”#” id=”no_window”>Submit</a></p><p><a href=”#” id=”new_window”>Submit & _blank</a></p> </form>And a Script attached : $(document).r
Jamie Taylor
jquery internet-explorer
I’ve got some code which when you click a button it populates the text of a textbox and then prepends another button to that div.It works in all browsers except IE where it gives a javascript error.The only way I can easily explain is by using my jsFiddleIf you use that in any browser apart from IE and click the Book now select a date and then another button will appear Submit.This is the correct behaviour but if you use IE then as soon as you select a date there’s a javascript error Unexpected
Vikdor
jquery html
in my html header i have <head><script src=”jquary.js”></script><script>$(document).ready(function(){ladda();});</script></head>and i load jquaryand in the body i have<form namne=”load”<fieldset><legend> load</legend><table><tr><td><div id=”innehåll1″>vill du ändra denna text</div></td></tr></table> <button id=”load_text”>ändra</button> </fieldset>and in my javascript i have
maxgee
php html mysql table variables
I am trying to get this data to go into a table so I can view it better on my website and I dont really understand how to combing PHP and HTML and I was getting this error Parse error: syntax error, unexpected ‘;’ I dont know if I combine them wrong so here is my code and tell me if I need to supply more than this line of code. <h2>Featured Event’s</h2> <body> <table cellpadding=”10″> <tbody> <?php echo ?><td><?php $eventname ?></td><?php
ZyteX
php html compiler-errors echo
I have a long HTML code which I’m echoing out through the echo code. However I get an error and if I remove the code on all the lines where it says there’s an error I get an error on the body instead. When I try to connect to my page I get this error: ( ! ) Parse error: syntax error, unexpected $end inC:\wamp\www\Legendary\new\usersettings.php on line 670http://fiddle.jshell.net/n4a6W/** EDIT ** I just noticed one of the errors, but the errors with almost all of the is still there…
Hooman
php html wordpress div wordpress-theming
I have created three columns like this:<div style=”float: left”>Left Column</div> <div style=”float: left”>Middle Column</div> <div style=”float: left”>Right Column</div>This works well on its own. However the moment I add it to my WordPress page template, by defining a left and right column around the existing main column something unexpected happens:http://venuscloud.com/crm-software/The left column is correctly placed and the middle column is as expected in
jlleblanc
javascript html ajax mootools
I’m trying to build some JavaScript in MooTools that fetches table row markup from the server, then adds it to a table. I have an object named htmlAjax that’s set as a MooTools Ajax object. The object gets the HTML from the server correctly (tested this in the Firebug console), but when I attempt to add this markup to a new element, the <td> elements get stripped out. Here is my function that captures the data from the HTTP request and attempts to add a row:htmlAjax.addEvent(‘onComplete’,
DriftingSteps
html osx
I don’t know if this question is relevant, but it has become an issue at my workplace, so…One of our clients (using a Mac) showed us a ‘problem’ in a dropdown that we made using the default <select> tag. The dropdown has 43 <option>’s. In our Windows PC, the dropdown has a scroll bar (as you can see in the screenshot) showing only some items at a time. But in the client’s browser, the dropdown shows all the items at once. Is there a way to have scroll bars on the dropdown on Mac P
Gumbo
html gui usability
I like to display more info on certain keywords in a web page. I don’t want to send the visitor to another page and I prefer to show the extra info on top of the current page.The keywords are in an html list. It’s basically a list of features and I want to offer more info about the features. So I have two ideas based on having ‘More Info’ or ‘?’ hyperlinks.The user hovers on the link and a popup window shows up with the info and goes away when they hover away. They click on the link, a popup win
Q_Mlilo
html css
Hie EveryoneI am designing a webpage with a fluid layout. I want to keep a 100% width and a 100% height. The problem is i dont know how to keep divs “left” and “right” with a 100% height inside their parent div, “wrapper”.<div id=”container” style=”width:100%; height:100%”> <div id=”header” style=”width:100%; height:100px”></div><div id=”wrapper” style=”width:100%; height:(100% – 100px)”><div id=”left” style=”width:250px; height:(100% – 100px)”></div><div
teresko
c# html asp.net-mvc
For example I have:<img src=”http://gateway.com/Providername/NameOfTheSupplier/RequestedImg.jpg” />Now some customers are complaining that there customers can see the company name in the url. Because its to much work to change the structure of the gateway I use, I search for another way to do it.Is there a way I can hide the src for the client? For example with base64, or another encryption that can decrypt client-side?
chhantyal
html css alignment
Please take a look at this fiddle: http://jsfiddle.net/d3uc9/4/I have a problem with this, as the two divs, in a table, next to each other, are not on the same margin line, even thought they share the same css class etc.What have I done wrong in the example, and must I change to make them on the same margin-top line?Thanks, I have tried to be as clear as possible.What I mean is that they should share the same margin-top line, but they don’t, and what must I do to fix this?
xiaohan2012
css cross-browser
This is a cross-browser style compatibility problem. And the effect is unexpected in Internet Explorer(<=7.0)The sample webpage is hereNotice the .pll_viewpoint element(The boxes whose colors changes gradually from red to grey). The expected effect should be:(See it in Chrome, FF, Opera or IE >= 8.0)New box should switch to new row if the width of upper row cannot contain this new box without overflowing the container’s width.However the effect in IE 7.0 is:(See it in IE <= 7.0)The “extr
Q_Mlilo
html css
Hie EveryoneI am designing a webpage with a fluid layout. I want to keep a 100% width and a 100% height. The problem is i dont know how to keep divs “left” and “right” with a 100% height inside their parent div, “wrapper”.<div id=”container” style=”width:100%; height:100%”> <div id=”header” style=”width:100%; height:100px”></div><div id=”wrapper” style=”width:100%; height:(100% – 100px)”><div id=”left” style=”width:250px; height:(100% – 100px)”></div><div
chhantyal
html css alignment
Please take a look at this fiddle: http://jsfiddle.net/d3uc9/4/I have a problem with this, as the two divs, in a table, next to each other, are not on the same margin line, even thought they share the same css class etc.What have I done wrong in the example, and must I change to make them on the same margin-top line?Thanks, I have tried to be as clear as possible.What I mean is that they should share the same margin-top line, but they don’t, and what must I do to fix this?
stanigator
css
Here are two separate pieces of code snippets to illustrate the difference. Thanks in advance.Snippet #1<style type=”text/css”>body {background-color: blue;} <—h1 {color: green;}p {color: purple;} </style>Snippet #2<style type=”text/css”>body {background: blue;} <—h1 {color: green;}p {color: purple;} </style>
Pat
html css margin negative-margin
I have created a JSFiddle of my case here: http://jsfiddle.net/gGCaX/ (Please take a look, so as to get some idea of what I am about to ask.)Now, coming to the point, Social Sharing buttons or counters are irregular when it comes to padding, margins etc as they come from different people.As you can see in the JSFIDDLE, I’ve managed to get them look good together. But the problem is, for one of the buttons (“SHARE” button – – the last in the line) I had to use “negative” margin as it was leaving
Dennis Callanan
jquery css button jquery-animate
<script>var swidth = $(window).width();var sheight = $(window).height();$(document).ready(function(){$(“#box”).animate({ //animates depending on screen sizetop: (sheight*0.22)+”px”,left: (swidth*0.25)+”px”,width:(swidth*0.3)-40+”px”,height: (sheight*0.35)-40+”px”,}, 2000, function(){$(‘<input type=”button” value=”My button”>’).appendTo(this).click(function(){ $(this).animate({ // reverses animation back to original size and locationtop: “150px”,left: “100px”,width:”1px”,height: “
travelboy
javascript jquery css image dimensions
I need to obtain the dimensions of an image, using a dynamically created image tag. It works. But ONLY using attr(‘width’) and ONLY if I do NOT add the image to the DOM. Otherwise, dimensions returned are zero. Why? :)this.img = $(‘<img/>’, {‘src’: e.url} ); // generate image this.img.appendTo(‘body’); // add to DOM this.img.load(function(self){return function(){ // when loaded call functionconsole.log(self.img.attr(‘src’));console.log(self.img.attr(‘wi
BoltClock
css css-selectors
I would like to know how to select first-child in actual scope, let me give you an example so you could understand my question correctly:HTML:<div class=”comment commentCompany”><div class=”commentTop”></div><div class=”commentMiddle”>Text of comment level two comment.<div class=”comment”><div class=”commentTop”></div><div class=”commentMiddle”>Text of comment level three.</div><div class=”commentBottom”></div> </div></di
Suhosin Pony
php html css internet-explorer menu
I have two problems. I tried visiting my website on Internet Explorer and i saw that everything is messed up. What should i do? In chrome i can visit the site normally.The second problem is that the menu with the navigation buttons is not stable. If i visit the site from other browsers or from other computers the menu margins from the HEADER IMAGE are not the same! What should I do about it ? I tried everything and nothing..Here is the site : http://aasiskos.webpages.auth.gr/1905_YPA/index.php “
PeterVR
css
This is my code for the two buttons:HTML:<div clas=”buttons”> <a class=”btn1″ href=”#”>Ture</a> <a class=”btn2″ href=”#”>False</a> </div>CSS:.btn1 { margin-bottom: 30px; margin-left: 150px; } .btn2 { margin-right: 150px; }However, “the margin-bottom:30px” attribute simply doesn’t work. It failed to position the button vertically. Even more weirdly, the “margin-right: 150px;” attribute doesn’t work for my btn2, and the two buttons are still adjoin to each other
Web site is in building