Search Results

Search found 23794 results on 952 pages for 'serverside javascript'.

Page 118/952 | < Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >

  • JavaScript's Associative Array / Object can't be read in functions

    - by Matrym
    At the very beginning of the javascript file, I have: var lbp = {}; lbp.defaults = { minLength: 40 }; I can successfully alert it afterwards, with: alert(lbp.defaults.minLength); But as soon as I put it inside a function, when I alert, I get "Undefined". What gives, and how do I avoid this? Is it absolutely necessary to pass this variable into each function, for example, by doing: function(lbp) { alert(lbp.defaults.minLength); } I would have thought that defining it first, it would attain global scope and not be required to be passed in? Thanks in advance for enlightening me :)

    Read the article

  • Get html from clipboard in javascript

    - by Sergey Osypchuk
    I need to implement task which is quite common feature for RichTextEditors - take HTML from clipboard. Can anyone help with guide on how to solve this task? It has to be cross platform (IE, FF, Chrome, Opera). I just started from this code: <script type="text/javascript"> $('.historyText').live('input paste', function(e) { var paste = e.clipboardData && e.clipboardData.getData ? e.clipboardData.getData('text/plain') : // Standard window.clipboardData && window.clipboardData.getData ? window.clipboardData.getData('Text') : // MS false; alert(paste); });</script> Both window.clipboardData and e.clipboardData are null (Chrome, Firefox)

    Read the article

  • javascript---click copy the content to the clipboard

    - by runeveryday
    the following is the code. but it doesn't work. what's wrong with it? thank you. <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>no title</title> <script type="text/javascript"> function copyToClipBoard(content){ var clipBoardContent = ''; clipBoardContent = content; window.clipboardData.setData("Text",clipBoardContent); alert('have copied to the clipboard'); } <body> <textarea rows="4" cols="60" id="url">www.example.com</textarea> <input type="button" value="click me" onclick="copyToClibBoard (document.getElementById ('url').value);" /> </body>

    Read the article

  • Php/Javascript to make a browser game?

    - by user335932
    I've been on and off intrested in making a text based browser game. I have been turned off by the idea because of the daunting amount of things to learn. PHP (or another sever side scripting language) Javascript HTML MySql And the fact of severs and apache.. Can I just pay for web hosting and by-pass having to set-up apache? Also how long will it take me to learn all thoose things well enough to start work on my game? Should I just stick with Flash and then C# for XNA?

    Read the article

  • Passing control's ID to javascript via ScriptControlDescriptor

    - by markiz
    I create a control in CreateChildControls(): HtmlGenericControl mycontrol= HtmlGenericControl("li"); mycontrol.ID = "controlID"; controlId = mycontrol.ID; protected virtual IEnumerable<ScriptDescriptor> GetScriptDescriptors() { ScriptControlDescriptor descriptor = new ScriptControlDescriptor("Project.TEditor", this.ClientID); descriptor.AddProperty("controlId", controlId); return new ScriptDescriptor[] { descriptor }; } Then in javascript i try to find this control using the ID property: alert($get(this.get_controlId())); I get null because the actual control ID has a prefix that was added by asp. How to solve that?

    Read the article

  • JavaScript closures in for-loop

    - by user1656447
    As explained here http://www.mennovanslooten.nl/blog/post/62/ code below outputs result just for "5x5" forgetting about anything before that. for (x = 1; x <= 5; x++) { for (y = 1; y <= 5; y++) { var cords = x+"x"+y; var el = document.getElementById(cords); el.addEventListener("click", function (e) { B_modeWindow('1', cords); }); } } As far I have the informations (blog link provided above) can't figure out how to alter showed code to fix it. How to walk around this code with JavaScript closure in my for-loop?

    Read the article

  • JavaScript inheritance extend function

    - by Zach
    I'm having some trouble understanding the IF clause at the end of this function from Pro JavaScript Design Patterns: function extend(subClass, superClass) { var F = function() {}; F.prototype = superClass.prototype; subClass.prototype = new F(); subClass.prototype.constructor = subClass; subClass.superclass = superClass.prototype; if(superClass.prototype.constructor == Object.prototype.constructor) { superClass.prototype.constructor = superClass; } } The book explains that these lines ensure that the superclass's constructor attribute is correctly set, even if the superclass is the Object class itself. Yet, if I omit those three lines and do the following: function SubClass() {}; extend(SubClass, Object); alert(Object.prototype.constructor == Object); The alert says 'true', which means the superclass's constructor is set correctly even without those last three lines. Under what conditions, then, does this IF statement do something useful? Thanks.

    Read the article

  • Will html5 and Javascript replace native applications?

    - by nimo
    I recently attended a conference on future of the web and web development and it was a lot of focus on HTML5 and how it will impact the way we look at the web and how we will use it. The majority of the speakers meant that it will replace native application on your desktop as well as in your mobile phone. I agree that you will be able to make a lot of great stuff with the new technology take bespin for example and the <video> and <canvas> tag will be amazing, but will it completely remove the need for native applications? Is there something you cannot do with Javascript and HTML5?

    Read the article

  • Sorting a value pair in Javascript

    - by Bradley M. Davis
    I must be missing the proper term or else I'm sure I could find the answer by searching... in any case, here's what I want to do. Through javascript, I get four variables (A, B, C, and D) that I would like to sort, and still keep track of the variable name (since it's encoded with meaning information). Sample Data: A = 2; B = 1; C = 4; D = 3; What I need to do now is sort them in value order (4,3,2,1) such that I can actually know the variable name ordering (C,D,A,B).

    Read the article

  • Rails3 Redirect for javascript/ajax

    - by Tiago
    Hi, I'm using a form with the remote => true. I have a validation that is working correctly. My problem is when the user enters all the correct information and writes the data at this time I do a redirect to the page of the show. Instead of redirecting, it displays the html of the show in my div. How can I make a javascript redirect that will understand? I did not want to use the window.location. Thanks...

    Read the article

  • Javascript find if english alphabets only

    - by Alec Smart
    Hello, Am trying to find some text only if it contains english letters and numbers using Javascript/jQuery. Am wondering what is the most efficient way to do this? Since there could be thousands of words, it should be as fast as possible and I don't want to use regex. var names[0] = 'test'; var names[1] = '???'; var names[2] = '??????'; for (i=0;i<names.length;i++) { if (names[i] == ENGLISHMATCHCODEHERE) { // do something here } } Thank you for your time.

    Read the article

  • javascript not working on localhost

    - by Adam McMahon
    Ok so I'm lost here, frustrated and pulling my hair and out. Plus probably about to be fired or take a pay cut. I moved Files from a development server to my local machine. The files are consistent (used diff tool), all the dependencies are there. It works for the most part. The problem is that the some of the javascript (not all) is just not working. We're using jquery and a lot of plugins for it. I've checked with the web developer plugin in firefox and all the js files are loading. I cleared the cache in both firefox and chrome multiple times to no avail. The development server is a windows server running wamp. My local machine is running ubuntu. Somebody tell me what I missed.

    Read the article

  • Use Javascript variable in PHP

    - by Rhepungus
    I have seen some answers to this question in previous posts, but no one has given a real working example, just psuedo code. Has anyone ever done this before? Basically, what i have is a variable in javascript (jquery), and i want to use this variable to drive a query (for an overlay window) i am going to run in php. From what i have read you can do this using an ajax call to the same page so it doesnt refresh itself, but i must be missing something because i can't get it working... Any examples out there? Thanks.

    Read the article

  • Customized alerts in Javascript not working properly

    - by mmh
    I am developing an addon to Firefox using addon-builder. I want to replace a normal alert box in Javascript with my addon. So, I have choosen customized alert boxes using jQuery. The jAlert details are given here. Now, I made customized alerts (with title and colors in alert). It is wroking properly on some websites. But on some websites the default CSS is dominating my jQuery CSS, which leads to unexpected alerts (ugly alerts).

    Read the article

  • is it possible to evaluate JavaScript code using XMLHttpRequest

    - by user1064717
    I'm trying to use this ajax request to call a file with some php which is working ok and some JavaScript which is not. any ideas? function showpart2(){ if(window.XMLHttpRequest){ xmlhttp = new XMLHttpRequest(); xmlhttp.open("GET","atuamae.org/parte2-encomendar.php",false); xmlhttp.send(null); } document.getElementById('part2').innerHTML = xmlhttp.responseText; eval(xmlhttp.responseText.getElementById('part2').innerHTML) setTimeout('showpart2()',15000); } showpart2(); </script>

    Read the article

  • how does memory stacks work in javascript

    - by user227353
    When we have code like: function a(){ var x =0; this.add=function(){ alert(x++); } } var test = new a(); test.add(); // alert 0 test.add(); // alert 1 test.add(); // alert 2 How does this work? Doesn't that the value of 'x' in a() should be 'gone' as soon as test = new a() is complete? The stack contains x should also be gone as well, right? Or, does javascript always keep all the stacks ever created in case they will be referenced in future? But that wouldn't be nice, would it...?

    Read the article

  • Long task in Javascript

    - by Misha Moroshko
    Why in the following code I see the whole page at once ? Thanks ! HTML: <div></div> CSS: div { width: 100px; height: 300px; border: 1px solid black; text-align: center; } Javascript: $(function() { for (var i=0; i<15; i++) { sleep(100); $("div").append("<span>--- " + i + " ---<br /></span>"); } function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } });

    Read the article

  • How can I see included JavaScript sources?

    - by Toddintr
    I am trying to script a web page using GreaseMonkey. (I am using Firebug for help in development.) The page has a small amount of JavaScript code, but that code pulls in other JS files from the site. Are the entire collection of JS files stored somewhere on the client side (i.e. on the filesystem somewhere) so that I can view them? Or better yet, is there a way I can view them in Firebug? I am a little overwhelmed by Firebug but will be able to follow instructions. Many thanks. (My first ever question on SO!) -Todd

    Read the article

  • Global JavaScript Variable Scope: Why doesn't this work?

    - by CoryDorning
    So I'm playing around with JavaScript and came across what I think to be an oddity. Is anyone able to explain the following? (i've included the alerted values as comments) Why is the first alert(msg) inside foo() returning undefined and not outside? var msg = 'outside'; function foo() { alert(msg); // undefined var msg = 'inside'; alert(msg); // inside } foo(); alert(msg); // outside Considering these both work fine: var msg = 'outside'; function foo() { alert(msg); // outside } alert(msg); // outside and: var msg = 'outside'; function foo() { var msg = 'inside'; alert(msg); // inside } alert(msg); // outside

    Read the article

  • javascript welcoming msgbox problem

    - by shouq
    hey... i'm doing my html and javascript class project and i want to have a msgbox welcoming the visitor asking for his name and then a welcoming msgbox shows up saying "hello (the name added)" i know how to do that but my only problem is that if i pressed back and went to the homepage of my website again, the msg will show up again asking for my name is there anyway to prevent this from happening? seriously don't want the visitor to wite his name each time he goes to the home page please help this is the code i'm using: <script> response = window.prompt("Welcome!","Please enter your name"); window.alert("hello " + response); </script> please help

    Read the article

  • Javascript replace using regexp

    - by netcrash
    <input type="text" value="[tabelas][something][oas]" id="allInput"> <script type="text/javascript"> allInput = document.getElementById('allInput'); var nivel = new Array('tabelas', 'produto'); for (var i =0; i < nivel.length ; i++ ) { alert(" oi => " + allInput.value + " <-- " + nivel[i]) ; var re = new RegExp("^\[" + nivel[i] + "\]\[.+\].+", "g"); alert(re); allInput.value = allInput.value.replace( re, "OLA"); alert(" oi 2 => " + allInput.value + " <-- " + nivel[i]) ; } </script> Basically I whant to replace "something2 in the [tabelas][something][otherfield] by a number of quantity, I have been playing with regexp and had different results from this using .replace(/expression/,xxx ) and new RegExp() . Best regards and thank you for any help.

    Read the article

  • Javascript: Perform function on form submit

    - by flight643
    Hopefully this is a pretty simple question! I've got the code working in jQuery to listen for a specific form on a page to be submitted and perform an alert when it is.. I.e.: The form itself doesn't have a name so I am targetting the form within a specific form ID. $("#content form").submit(function() { alert("lorem ipsum dolor?"); }); What would be the syntax for performing this in javascript alone without using jquery? For example, I have this code (below) and just am unsure of how to listen for the form to be submitted to perform an action.. var submitform = document.getElementById("content").getElementsByTagName("form"); Thanks!

    Read the article

  • copy - paste in javascript

    - by Dumbledore of flash
    I have this code <input name="mpan[]" value="" maxlength="2" size="2"> <input name="mpan[]" value="" maxlength="2" size="3"> <input name="mpan[]" value="" maxlength="2" size="3"> <input name="mpan[]" value="" maxlength="2" size="12"> What I have to do is I am provided with a large key for example 0380112129021. When I do Ctrl+C on that key and select any box and press Ctrl+V, the number automatically get pasted in different box, for example: first input box gets 03, next gets 801, next gets 112 and rest gets pasted on last one 129021.how do i achive this from javascript

    Read the article

  • Regular Expression for accurate word-count using JavaScript

    - by Haidon
    I'm trying to put together a regular expression for a JavaScript command that accurately counts the number of words in a textarea. One solution I had found is as follows: document.querySelector("#wordcount").innerHTML = document.querySelector("#editor").value.split(/\b\w+\b/).length -1; But this doesn't count any non-Latin characters (eg: Cyrillic, Hangul, etc); it skips over them completely. Another one I put together: document.querySelector("#wordcount").innerHTML = document.querySelector("#editor").value.split(/\s+/g).length -1; But this doesn't count accurately unless the document ends in a space character. If a space character is appended to the value being counted it counts 1 word even with an empty document. Furthermore, if the document begins with a space character an extraneous word is counted. Is there a regular expression I can put into this command that counts the words accurately, regardless of input method?

    Read the article

  • HTML, Javascript, PHP and Actionscript all in one Eclipse install (2010)

    - by ThunderChunky_SF
    I just wanted to poll the community and see which plugins people are currently using to get all of these different technologies running in Eclipse. I saw this thread which mentioned Spket & WPT: http://stackoverflow.com/questions/1575617/eclipse-which-plugins-for-html-javascript But I noticed that Spket doesn't seem to have been updated since October of 2009 so I'm wondering if it's still a good tool to use. I'm not sure what would be best for PHP since it seems like some of the tools are disjointed at the moment. For Actionscript I know I can just install the latest Flash Builder plugin and be done. Any suggestions are greatly appreciated.

    Read the article

< Previous Page | 114 115 116 117 118 119 120 121 122 123 124 125  | Next Page >