Search Results

Search found 16230 results on 650 pages for 'three js'.

Page 44/650 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • [JS] getSelection on DIV contentEditable

    - by cactoos
    Hi all ! I am trying to achieve project and i must do a WYSIWYG editor in JavaScript. I can't use an existing editor because I need use my plugins (for example a colorPicker or imagePicker).. For this time I have this HTML : <div class="K_editor" id="idExample"> <div class="K_links"> <div class="K_editor_link K_editor_linkBold">B</div> <div class="K_editor_link K_editor_linkItalic">I</div> <div class="K_editor_link K_editor_linkUnderline">U</div> </div> <iframe width="696" height="212" frameborder="0" src="js/myEditor_iFrame.php"> <html> <head/> <body> <div id="contentIframe" contenteditable="true"> This is a test code, with <strong>bold</strong> text and <em>italic</em> text. </div> </body> </html> </iframe> <input type="submit"/> </div> On event click on ".K_editor_link", a function is open with arguments : - tagStart (exemple '', or '') - tagEnd (exemple '', or '') - id (here 'idExample') I know get a Selection on Textarea but "setSelectionRange()", ".selectionStart" and ".selectionEnd" are only for textbox (XUL), input (XHTML) or textarea (XHTML). Why can I do for do that ?? I'm realy block.. Thank all ! CactO_o's

    Read the article

  • Raphael JS image animation performance.

    - by michael
    Hi, I'm trying to create an image animation using Raphael JS. I want the effect of a bee moving randomly across the page, I've got a working example but it's a bit "jittery", and I'm getting this warning in the console: "Resource interpreted as image but transferred with MIME type text/html" I'm not sure if the warning is causing the "jittery" movement or its just the way I approached it using maths. If anyone has a better way to create the effect, or improvements please let me know. I have a demo online here and heres my javascript code: function random(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function BEE(x, y, scale) { this.x = x; this.y = y; this.s = scale; this.paper = Raphael("head", 915, 250); this.draw = function() { this.paper.clear(); this.paper.image("bee.png", this.x, this.y, 159*this.s, 217*this.s); } this.update = function() { var deg = random(-25, 25); var newX = Math.cos(Raphael.rad(deg)) * 2; var newY = Math.sin(Raphael.rad(deg)) * 2; this.x += newX; this.y += newY; if( this.x > 915) { this.x = 0; } if( this.y > 250 || this.y < 0 ) { this.y = 125; } } } $(document).ready(function() { var bee = new BEE(100, 150, 0.4); var timer = setInterval(function(){ bee.draw(); bee.update(); }, 15); }

    Read the article

  • Automatic multi-page multi-column flowing text with QtWebkit (HTML/CSS/JS -> PDF)

    - by Peter Boughton
    I have some HTML documents that are converted to PDF, using software that renders using QtWebkit (not sure which version). Currently, the documents have specific tags to split into columns and pages - so whenever the wording changes, it is a manual time-consuming process to move these tags so that the columns and pages fit. Can anyone provide a way to have text auto-wrapped into the next column/page (as appropriate) when it reaches the bottom of the current container? Any HTML, CSS or JS supported by QtWebkit is ok (assuming it works in the PDF converter). (I have tested the webkit-column-* in CSS3 and it appears QtWebkit does not support this.) To make things more exciting, it also needs to: - put a header at the top of each page, with page X of Y numbering; - if an odd number of pages, add a blank page at the end (with no header); - have the ability to say "don't break inside this block" or "don't break after this header" I have put some quick example initial markup and target markup to help explain what I'm trying to do. (The actual documents are far more complicated than that, but I need a simple proof-of-concept before I attack the real ones.) Any suggestions? Update: I've got a partially working solution using Aaron's "filling up" suggestion - I'll post more details in a bit.

    Read the article

  • Shadowbox.js and dailymotion videos

    - by Greenie
    Hi there. I have a site set up with some thumbs and links to videos hosted on vimeo. I show them in a overlay using shadowbox.js. This works perfect. Now I want to add a video hosted on dailymotion, but it doesn't work. The working link to vimeo video: <a rel="shadowbox;height=636;width=956" href="http://vimeo.com/moogaloop.swf?clip_id=11377863&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00ADEF&fullscreen=1" class="player_text">thumbnail here</a> The non working link to dailymotion video: <a rel="shadowbox;height=636;width=956" href="http://www.dailymotion.com/swf/xd6g8y?related=0&autoplay=1" class="player_text">thumbnail here</a> When the href is pasted in a browser, both links work fine. Both are played in a swf as far as I can see. So I can't see why shadowbox won't show it. Unless its a permission problem on the dailymotion video. Anyone know what I'm doing wrong?

    Read the article

  • Can't empty JS array....

    - by solefald
    Yes, I am having issues with this very basic (or so it seems) thing. I am pretty new to JS and still trying to get my head around it, but I am pretty familiar with PHP and have never experienced anything like this. I just can not empty this damn array, and stuff keeps getting added to the end every time i run this. I have no idea why, and i am starting to think that it is somehow related to the way chekbox id's are named, but i may be mistaking.... id="alias[1321-213]", id="alias[1128-397]", id="alias[77-5467]" and so on. I have tried sticking checkboxes = []; and checkboxes.length = 0; In every place possible. Right after the beginning of the function, at the end of the function, even outside, right before the function, but it does not help, and the only way to empty this array is to reload the page. Please tell me what I am doing wrong, or at least point me to a place where i can RTFM. I am completely out of ideas here. function() { var checkboxes = new Array(); checkboxes = $(':input[name="checkbox"]'); $.each(checkboxes, function(key, value) { console.log(value.id); alert(value.id); } ); checkboxes.length = 0; } I have also read Mastering Javascript Arrays 3 times to make sure I am not doing something wrong, but still can't figure it out....

    Read the article

  • JS sort works in Firefox but not IE - can't work out why

    - by Max Williams
    I have a line in a javascript function that sort an array of objects based on the order of another array of strings. This is working in firefox but not in IE and i don't know why. Here's what my data looks like going into the sort call. (I'm using an array of three items just to illustrate the point here). //cherry first then the rest in alphabetical order originalData = ['cherry','apple','banana','clementine','nectarine','plum'] //data before sorting - note how clementine is second item - we wan to to to be after apple and banana csub = [ {"value":"cherry","data":["cherry"],"result":"cherry"}, {"value":"clementine","data":["clementine"],"result":"clementine"}, {"value":"apple","data":["apple"],"result":"apple"}, {"value":"banana","data":["banana"],"result":"banana"}, {"value":"nectarine","data":["nectarine"],"result":"nectarine"}, {"value":"plum","data":["plum"],"result":"plum"} ] //after sorting, csub has been rearranged but still isn't right: clementine is before banana csubSorted = [ {"value":"cherry","data":["cherry"],"result":"cherry"}, {"value":"apple","data":["apple"],"result":"apple"}, {"value":"clementine","data":["clementine"],"result":"clementine"}, {"value":"banana","data":["banana"],"result":"banana"}, {"value":"nectarine","data":["nectarine"],"result":"nectarine"}, {"value":"plum","data":["plum"],"result":"plum"} ] Here's the actual sort code: csubSorted = csub.sort(function(a,b){ return (originalData.indexOf(a.value) > originalData.indexOf(b.value)); }); Can anyone see why this wouldn't work? Is the basic javascript sort function not cross-browser compatible? Can i do this a different way (eg with jquery) that would be cross-browser? grateful for any advice - max

    Read the article

  • firefox reading web page from local JS file -- access to restricted URI denied, code: 1012, nsresult

    - by macias
    My problem is -- I have a html file which is really JS program, which reads web pages and show them in customized manner (i.e. it displays the same content in a different way). Basically, I create XMLHttpRequest object and then req.open("GET", web_page_address, false); req.send(""); This gives me (in firefox) an error: Error: uncaught exception: [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" I already googled, and looked at SO but all other issues are very similar with those two exceptions: the file I open in firefox is a local file, opened directly in browser -- I don't have www server running at localhost I don't have any control over the web pages I am reading stuff from So, several solutions I've seen so far (like adding PHP proxy, changing the way external server sends data) cannot be applied here. What else can be done in such case? Another story is I am wondering if such strict security for directly local file has any sense. Thank you in advance for tips/links/etc. Have a nice day!

    Read the article

  • JS: capture a static snapshot of an object at a point in time with a method

    - by Barney
    I have a JS object I use to store DOM info for easy reference in an elaborate GUI. It starts like this: var dom = { m:{ old:{}, page:{x:0,y:0}, view:{x:0,y:0}, update:function(){ this.old = this; this.page.x = $(window).width(); this.page.y = $(window).height(); this.view.x = $(document).width(); this.view.y = window.innerHeight || $(window).height(); } I call the function on window resize: $(window).resize(function(){dom.m.update()}); The problem is with dom.m.old. I would have thought that by calling it in the dom.m.update() method before the new values for the other properties are assigned, at any point in time dom.m.old would contain a snapshot of the dom.m object as of the last update – but instead, it's always identical to dom.m. I've just got a pointless recursion method. Why isn't this working? How can I get a static snapshot of the object that won't update without being specifically told to? Comments explaining how I shouldn't even want to be doing anything remotely like this in the first place are very welcome :)

    Read the article

  • Raphael.js map default fill colors

    - by RIDER
    I am trying to familiarize myself with raphael.js. I want to create a USA map that already has default colors for each state and those colors stay there. Here is what I came up with. If you look at AK, I'm getting the default color loaded, but if I highlight another state, the default color for AK disappears. I want AK - and other states - to stay the same color. Specifically, I don't know what is clearing out my AK full color. I think part of this statement is clearing out the fill cover when I mouseover a different state: for (var state in aus) { //aus[state].color = Raphael.getColor(); (function (st, state) { st[0].style.cursor = "pointer"; st[0].onmouseover = function () { current && aus[current].animate({fill: "#333", stroke: "#666"}, 500) && (document.getElementById(current).style.display = ""); st.animate({fill: st.color, stroke: "#ccc"}, 500); st.toFront(); R.safari(); document.getElementById(state).style.display = "block"; current = state; }; })(aus[state], state); } Any ideas where I might be going wrong?

    Read the article

  • jscript1.js error in webforms when applying routing

    - by Sean N
    Hello I have a project using webforms. I applied routing on one of the page. My route is structure like this : http://localhost:3576/Request/Admin/Rejected/ = http://localhost:3576/Request/{role}/{action}/{id} Everything works great but i have a javascript error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; InfoPath.2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Fri, 7 May 2010 13:35:54 UTC Message: Syntax error Line: 3 Char: 1 Code: 0 URI: http://localhost:3576/Request/Admin/Rejected/JScript1.js I think it's trying to route to the file where i stored my javascript functions. Any suggestion?

    Read the article

  • Looping login with Facebook JS SDK and Rails

    - by nafe
    I'm using the Facebook JS SDK for single-sign with my rails app. I translated the php code from the Facebook example (at the bottom of the page under "Single Sign-on with the JavaScript SDK") into ruby. This appeared to be working great but I've noticed one user that gets continual redirects when trying to login. The logs look like: Processing UsersController#login (for X.X.X.X at 2010-05-22 17:25:55) [GET] Redirected to http://myapp.com/ Completed in 0ms (DB: 0) | 302 Found [http://myapp.com/login] (times as many entries as my unfortunate user leaves the browser redirecting in a loop). My client side code includes a callback with the "auth.sessionChange": FB.Event.subscribe('auth.sessionChange', function(response) { if (response.session) { // A user has logged in, and a new cookie has been saved window.location = "/login"; } else { // The user has logged out, and the cookie has been cleared window.location = "/logout"; } }); So it seems to me like this event is continually firing. Although, I can't test this theory because I can't recreate this scenario locally. I don't think it's the rails controller. The code here is just: def login # if first time user create db entry # now redirect back to where the user came from begin redirect_to :back rescue ActionController::RedirectBackError redirect_to root_url end end Does anyone have any idea on what's going on?

    Read the article

  • background-color hex to js variable (jquery)

    - by Ezdaroth
    I'm kinda new to javascript and jquery and now I'm facing a problem: I need to post some data to php and one bit of the data needs to be the background color hex of div X. Jquery has css("background-color") function and with it I can get rgb value of the background into a javascript variable. The css function seems to return a string like this rgb(0, 70, 255). I couldn't find any way to get hex of the background-color (even tho it's set as hex in css). So it seems like I need to convert it. I found a function for converting rgb to hex, but it needs to be called with three different variables, r, g and b. So I would need to parse the string rgb(x,xx,xxx) into var r=x; var g=xx; var b=xxx; somehow. I tried to google parsing strings with javascript, but didn't really understand the regular expressions thing. Could someone tell me if there's a way to get background-color of div as hex, or explain how to convert the string into 3 different variables.

    Read the article

  • VS2010 renders controls JS awkwardly

    - by Juergen Hoffmann
    I have created a Website Project in VS2010. My Controls are not rendered correctly. The JS that is produced is not correctly formatted. Here is an example: protected void Page_PreRender(object sender, EventArgs e) { if (!IsPostBack) { objListBox.Attributes.Add("onchange", "Control_doPostBack('" + objListBox.ClientID + "','ListBox_OnClick'); return false;"); objListBox.Attributes.Add("onblur", "Control_doPostBack('" + trListbox.ClientID + "','ListBox_OnBlur'); return false;"); img.Attributes.Add("onclick", "Control_doPostBack('" + trListbox.ClientID + "','IMG_OnClick'); return false;"); } } and the responding control is rendered as: <select size="4" name="ctl00$PlaceHolder_Content$drop$objListBox" onchange="Control_doPostBack(&#39;PlaceHolder_Content_drop_objListBox&#39;,&#39;ListBox_OnClick&#39;); return false;setTimeout(&#39;__doPostBack(\&#39;ctl00$PlaceHolder_Content$drop$objListBox\&#39;,\&#39;\&#39;)&#39;, 0)" id="PlaceHolder_Content_drop_objListBox" onblur="Control_doPostBack(&#39;PlaceHolder_Content_drop_trListbox&#39;,&#39;ListBox_OnBlur&#39;); return false;" style="position:absolute;"> </select> As you can see, the ' are rendered to &#39 which screwes up the Browser. Is there a tweak to msbuild or inside the project properties? Any help is highly appreciated.

    Read the article

  • ASP.Net MVC, JS injection and System.ArgumentException - Illegal Characters in path

    - by Mose
    Hi, In my ASP.Net MVC application, I use custom error handling. I want to perform custom actions for each error case I meet in my application. So I override Application_Error, get the Server.GetLastError(); and do my business depending on the exception, the current user, the current URL (the application runs on many domains), the user IP, and many others. Obviousely, the application is often the target of hackers. In almost all the case it's not a problem to detect and manage it, but for some JS URL attacks, my error handling does not perform what I want it to do. Ex (from logs) : http://localhost:1809/Scripts/]||!o.support.htmlSerialize&&[1 When I got such an URL, an exception is raised when accessing the ConnectionStrings section in the web.config, and I can't even redirect to another URL. It leads to a "System.ArgumentException - Illegal Characters in path, etc." The screenshot below shows the problem : http://screencast.com/t/Y2I1YWU4 An obvious solution is to write a HTTP module to filter the urls before they reach my application, but I'd like to avoid it because : I like having the whole security being managed in one place (in the Application_Error() method) In the module I cannot access the whole data I have in the application itself (application specific data I don't want to debate here) Questions : Did you meet this problem ? How did you manage it ? Thanks for you suggestions, Mose

    Read the article

  • Function in JS returns undefined

    - by megapool020
    Hello there, I have the following problem. The alert allways returns undefined, but I know it has a value. What am I doing wrong. I'm out of solutions... I'm using JQUERY jquery-1.4.2.min.js Tnx in advance $(document).ready(function(){ $('#generateButton').click(createIBAN); }); function createIBAN(){ //---- First check if a bank has been selected, //---- if not, then show error if($('#selectBank').val()==''){ alert('Selecte a bank!'); }else{ var bankAccount = generateBankAccount(); alert(bankAccount); } return false; } function generateBankAccount(){ //---- Create "elfproef" bankaccount var bankAccount = ''; //---- Set the amount of digits in a bankaccount digitAmount = 9; //---- Make random digitstring for (var i = 0; i < digitAmount; i++) { bankAccount += Math.floor(Math.random() * digitAmount); } //---- validate the string, if not "elf-proef" if (elfProef(bankAccount)==false) { //---- regenerate the string generateBankAccount(); }else{ return bankAccount; } } function elfProef(bankAccount) { //---- set sum to 0 and start the for-loop for counting var sum = 0; for (var i = 0; i < digitAmount; i++) { //---- for every digit multiply it times 9 - number //---- of the digit and count it to the sum var sum += bankAccount.charAt(i) * (digitAmount - i); } //---- Check if sum can be devided by 11 without having ##,## if(sum % 11==0){ //---- return true means string is "elf-proef" return true; }else { //---- String is not "elf-proef", try again return false; } }

    Read the article

  • Is there a Firebug console -vsdoc.js?

    - by David Murdoch
    If not, does anyone care to write one? I would do it myself...but I don't have time right now...maybe next week (unless someone beats me to it). If you are bored and want to compile the vsdoc: Here is the Firebug API. Here is a blog post about the format for VS doc comments for intellisense. Here is an example vsdoc (jquery-1.4.1-vsdoc.js). I created the following because I kept typing cosnole instead of console. You can use it as a starting point (ish). console = { /// <summary> /// 1: The javascript console /// </summary> /// <returns type="Object" /> }; console.log = function (object) { /// <summary> /// Write to the console's log /// </summary> /// <returns type="null" /> /// <param name="object" type="Object"> /// Write the object to the console's log /// </param> };

    Read the article

  • SetInterval missing property in js class

    - by sebastian
    I wrote simple class in JS witch works, but i had problem when i try use setInterval with it. Ex. if i do something like that ball = new ball(5,10,0, '#canvas'); ball.draw(); ball.draw(); ball.draw(); ball.draw(); It works. But this: ball = new ball(5,10,0, '#canvas'); setInterval(ball.draw, 100); Not work. I get error that values are undefined. function ball (x,y,z,holdingEl) { this.r = 5; //zmienna przechowujaca promien pilki this.size = this.r *2; // zmienna przechowujaca rozmiar this.ballSpeed = 100; // predkosc pilki this.ballWeight = 0.45; // masa pilki this.maxFootContactTime = 0.2; // maksymalny czas kontaktu pilki z noga - stala this.ctx = jQuery(holdingEl)[0].getContext("2d"); // obiekt pilki this.intVal = 100 // predkosc odswiezania this.currentPos = { // wspolrzedne pozycji x: x, y: y, z: z } this.interactionPos = { // wspolrzedne pozycji ostatniej interakcji x: -1, y: -1, z: -1 } this.direct = { // kierunek w kazdej plaszczyznie x : 1, y : 0, z : 0 } this.draw = function (){ this.ctx.clearRect(0,0,1100,800); this.ctx.beginPath(); this.ctx.arc(this.currentPos.x, this.currentPos.y, this.r, 0, Math.PI*2, true); this.ctx.closePath(); this.ctx.fill(); } }

    Read the article

  • How to implement conditional render in JS?

    - by mare
    Below is the JS (jQuery) code of autocomplete's result function. You can see there's some lines where I print out <li>s containing some data properties (that come in as a result of automcomplete's AJAX call). How could I rewrite this so that <li> would be conditionally rendered based on whether the property contains any value being either int or string (not empty string or whitespace) or something else that can be represented as string? $(".clients-dropdown").result(function (event, data, formatted) { if (data) { // set the hidden input that we need for Client entity rematerialize $(".client-id").val(data.client_id); if (data.ClientName && data.Address1 && data.postalcode && data.postname) { $(".client-address").html( "<li>" + data.ClientName + "</li>" + "<li>" + data.Address1 + "</li>" + "<li>" + data.postalcode + " " + data.postname + "</li>" ); $(".client-details").html( "<li>" + data.PrettyId + "</li>" + "<li>" + data.VatNo + "</li>" + "<li>" + data.Phone + "</li>" + "<li>" + data.Mobile + "</li>" + "<li>" + data.Email1 + "</li>" + "<li>" + data.Contact + "</li>" ); } } Also, for the AJAX call, should my server side action return null when there's a null for a property in the database or empty string?

    Read the article

  • Firefox extension js object initialization

    - by Michael
    Note: this is about Firefox extension, not a js general question. In Firefox extension project I need my javascript object to be initialized just once per Firefox window. Otherwise each time I open my window a new timers will be engaged, new properties will be used, so everything will start from scratch. hope example below will demystify my question :) var StupidExtension { statusBarValue: "Not Initialized Yet", startup: function () { ... // Show statusBarValue in Status Bar Panel }, initTimerToRetrieveStatusBarValueFromNetwork: function () { ... } } so each time you hit Ctrl+N a new window you will see "Not Initialized Yet" and then new timer will be fired, so after some time it retrieve data from network you will see value also on second window and so on. Ideally would be to have just a single timer function running and updating all status bar panels in all Firefox windows. Of course I can do some caching, like saving the value in prefs or some other storage, then show it from there. But I feel like this is artificial. So the question will be is there "native" technique of making static some parts of the object among all Firefox window instances?

    Read the article

  • JS: Object itteration fails

    - by Newbie
    Hello! In my JS, I have an object called box_object. It looks like this: ({ id:"3", text:"this is a box object", connection_parent:["1", "2"], connection_child:["5", "6"], connectiondata_child:{ 0:{id:"5", linepoint:"bottom"}, 1:{id:"6", linepoint:"bottom"}}, connectiondata_parent:{ 0:{id:"1", linepoint:"top"}, 1:{id:"2", linepoint:"top"}} }) Now, I want to add some position values to box_object.connectiondata_parent. Using jQuery I can use the .each() method. So I tried it, but it failed. In my function I do the following: $(box_object.connectiondata_parent).each(function(it, obj){ if(typeof(obj[it]) != "undefined" && obj[it].linepoint == "top"){ var point_position_top = new Object(); point_position_top.left = startingpoint_left; point_position_top.top = startingpoint_top; obj[it].position = point_position_top; }else if(typeof(obj[it]) != "undefined" && obj[it].linepoint == "bottom"){ var point_position_bottom = new Object(); point_position_bottom.left = startingpoint_left; point_position_bottom.top = startingpoint_bottom; obj[it].position = point_position_bottom; }else{} }); After the function my box_object looks like this: ({ id:"3", text:"this is third box", connection_parent:["1", "2"], connection_child:["5", "6"], connectiondata_child:{ 0:{id:"5", linepoint:"bottom"}, 1:{id:"6", linepoint:"bottom"}}, connectiondata_parent:{ 0:{id:"1", linepoint:"top", position:{left:500, top:104}}, 1:{id:"2", linepoint:"top"}} }) It seems it only writes the values to the first "value". Any Ideas why?

    Read the article

  • Angular JS pagination after data loaded

    - by Federico Bucchi
    do you have any example of Angular JS elements pagination loaded from I file? I found this example: http://jsfiddle.net/SAWsA/11/ Now, instead of having this: $scope.items = [ {"id":"1","name":"name 1","description":"description 1","field3":"field3 1","field4":"field4 1","field5 ":"field5 1"}, {"id":"2","name":"name 2","description":"description 1","field3":"field3 2","field4":"field4 2","field5 ":"field5 2"}, {"id":"3","name":"name 3","description":"description 1","field3":"field3 3","field4":"field4 3","field5 ":"field5 3"}, {"id":"4","name":"name 4","description":"description 1","field3":"field3 4","field4":"field4 4","field5 ":"field5 4"}, {"id":"5","name":"name 5","description":"description 1","field3":"field3 5","field4":"field4 5","field5 ":"field5 5"}, {"id":"6","name":"name 6","description":"description 1","field3":"field3 6","field4":"field4 6","field5 ":"field5 6"}, {"id":"7","name":"name 7","description":"description 1","field3":"field3 7","field4":"field4 7","field5 ":"field5 7"}, {"id":"8","name":"name 8","description":"description 1","field3":"field3 8","field4":"field4 8","field5 ":"field5 8"}, {"id":"9","name":"name 9","description":"description 1","field3":"field3 9","field4":"field4 9","field5 ":"field5 9"}, {"id":"10","name":"name 10","description":"description 1","field3":"field3 10","field4":"field4 10","field5 ":"field5 10"}, {"id":"11","name":"name 11","description":"description 1","field3":"field3 11","field4":"field4 11","field5 ":"field5 11"}, {"id":"12","name":"name 12","description":"description 1","field3":"field3 12","field4":"field4 12","field5 ":"field5 12"}, {"id":"13","name":"name 13","description":"description 1","field3":"field3 13","field4":"field4 13","field5 ":"field5 13"}, {"id":"14","name":"name 14","description":"description 1","field3":"field3 14","field4":"field4 14","field5 ":"field5 14"}, {"id":"15","name":"name 15","description":"description 1","field3":"field3 15","field4":"field4 15","field5 ":"field5 15"}, {"id":"16","name":"name 16","description":"description 1","field3":"field3 16","field4":"field4 16","field5 ":"field5 16"}, {"id":"17","name":"name 17","description":"description 1","field3":"field3 17","field4":"field4 17","field5 ":"field5 17"}, {"id":"18","name":"name 18","description":"description 1","field3":"field3 18","field4":"field4 18","field5 ":"field5 18"}, {"id":"19","name":"name 19","description":"description 1","field3":"field3 19","field4":"field4 19","field5 ":"field5 19"}, {"id":"20","name":"name 20","description":"description 1","field3":"field3 20","field4":"field4 20","field5 ":"field5 20"} ]; I have to use something generated by: $http.get('/json/mocks/apps/applications.json') .then(function (result) { $scope.items = result.data.applications; }); How would you create the pagination waiting for the data loaded from $http.get?

    Read the article

  • page loads twice due to js code

    - by Cristian Boariu
    Hi, I have this div inside a repeater, where i set the class, onmouseover and onmouseout properties from code behind: <div id="Div1" runat="server" class="<%# getClassProduct(Container.ItemIndex) %>" onmouseover="<%# getClassProductOver(Container.ItemIndex) %>" onmouseout="<%# getClassProductOut(Container.ItemIndex) %>"> codebehind: public String getClassProduct(Object index) { int indexItem = Int32.Parse(index.ToString()); if (indexItem == 3) return "produs_box produs_box_wrap overitem lastbox"; else return "produs_box produs_box_wrap overitem"; } public String getClassProductOver(Object index) { int indexItem = Int32.Parse(index.ToString()); if (indexItem == 3) return "this.className='produs_box produs_box_wrap overitem_ lastbox'"; else return "this.className='produs_box produs_box_wrap overitem_'"; } public String getClassProductOut(Object index) { int indexItem = Int32.Parse(index.ToString()); if (indexItem == 3) return "this.className='produs_box produs_box_wrap overitem lastbox'"; else return "this.className='produs_box produs_box_wrap overitem'"; } Well, the problem is that, my Page_Load is fired twice, and there i have some code which i want to execute only ONCE: if (!Page.IsPostBack) { ..code to execute once } This code is fired initially, and after the page is rendered, it is called again, and executed again due to that js... Anyone can recommend a workaround? Thanks in advance.

    Read the article

  • Problems with my JS array undefined x 7

    - by Dave
    I have an array im trying to loop through to create a new type of array specific to my current page. My array looks like this: //$_SESSION['data'] = Array ( [0] => 1 [1] => 0 [2] => Tom [8] => 1 [4] => 1 [5] => Array ( [7] => Array ( [0] => Andrew [1] => 1 [2] => 1 [4] => 0 [5] => avatar.jpg [6] => 1 ) ) [6] => Array ( [0] => 1 [1] => 2 ) ) So in my JS file i have this: var stats = <? echo $_SESSION['data'][5]); ?> ; //this is the array my_data = new Array(); for(var key in stats){ if(key in my_data){} else { //prevent double entry my_data[key] = new Array(); my_data[key][0] = stats[key][6]; my_data[key][1] = stats[key][5]; my_data[key][2] = stats[key][2]; my_data[key][3] = stats[key][0]; } } console.log(my_data); Now in console.log i get this : [undefined × 7, Array[4] 0: "1" 1: "avatar.jpg" 2: "1" 3: "Andrew" length: 4 __proto__: Array[0] ] I'm wondering why it is saying undefined x7?

    Read the article

  • UIWebview :: Text :: HTML :: JS

    - by user306089
    hello, 1- i load a text from a txt file 2- i show it into a html "file" 3- problem : 3-a : this code works : i create my page by code and i insert my text myText = ... loaded from an array of texts ...; NSString *myDescriptionHTML = [NSString stringWithFormat:@"<html> \n" "<head> \n" "<style type=\"text/css\"> \n" "body {font-family: \"%@\"; font-size: 1.0f + 'em'; color:#FFF;}\n" "</style> \n" "</head> \n" "<body id=\"myid\">%@</body> \n" "</html>", @"Arial", myText]; [self.myWebView loadHTMLString:myDescriptionHTML baseURL:nil]; 3-b but this one does not work : i load a html page already created and i inject my text into using JS : myText = ... loaded from an array of texts ...; [self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"myid\").innerHTML = \"%@\";", myText]]; 3-c but this one working : same as 3-b but i init my text with a string in the code itself : myText = @"hello all"; [self.myWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"document.getElementById(\"myid\").innerHTML = \"%@\";", myText]]; any help to understand what's wrong with 3-b ? thank you

    Read the article

  • Script (AJAX or JS) does not work properly in IE8

    - by Uno Mein Ame
    I have a js/ajax script at http://worldcitiesdatabase.info/test1/ I just received a complaint that it does not work properly in IE8. Onchange seems to work, but then the next menu is not populated. Can you please help me figure it out? Thanks Not sure what the problematic part of the code is. Here is my guess: if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } newList=""; xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { newList = xmlhttp.responseText; m1.innerHTML=newList; m1.disabled=false; } if (menuname=="showCountry") { var c1=document.getElementById('showRegion'); if (c1.options.length==2) { if (c1.options[0].value=='NONE') { c1.remove(0); c1.value='0'; reloadmenu(c1); } } } } xmlhttp.open("GET",newFile+".php?q="+menuvalue,true); xmlhttp.send();

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >