Search Results

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

Page 115/952 | < Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >

  • Javascript Date Picker Into A Textfield

    - by Dilukshan Mahendra
    I'm trying to use a date picker for a date field but my date fields ID is a dynamic id, since the fields generates in table rows, like <input type="text" id="date<%=n%>"/> But my date picker script requires the ID to attach the date picker into the above text field like below, <script type="text/javascript"> new datepickr('datepick', { dateFormat: 'Y-m-d' }); </script> Is there any other way to make this work?

    Read the article

  • JavaScript array to PHP array then process in PHP and return

    - by Constructor
    Example: javascript: var mycourses=new Array(); mycourses[0]="History"; mycourses[1]="Math"; mycourses[1][0]="Introduction to math"; mycourses[1][1]="Math 2"; mycourses[1][2]="Math 3"; PHP will then run these values through functions (please note values are mostly not strings as in the example above but rather numbers), the functions will return some text which will than be displayed in a form How should I go about doing this? p.s.: I found some similar stuff, but nothing quite like this... as far as I see I will have to use JSON (is there a way to code it from JS automatically - saw this for strings) and AJAX

    Read the article

  • Using javascript to call controller methond in mvc

    - by Christian Thoresson Dahl
    Im trying to make a table row work as a link to another view in my mvc website. Instead of using the standard "Details" link provided by the auto generated table list, I would like to use the table row as a link to the "Details" view instead. So somehow I need to make the row work as a link. Each rom has a unique id that I need to pass on to the controller method. I have tried different solutions but noting happens when I press on the table row... So far this is what I have: <script type="text/javascript"> $(document).ready(function(){ $('#customers tr').click(function () { var id = $(this).attr('id'); $.ajax({ url: "Customer/Details" + id, succes: function () { } }); }) }) </script> My controller method: public ActionResult Details(int id) { Customer model = new Customer(); model = this.dbEntities.Customers.Where(c => c.Customer_ID == id).Single(); return View(model); }

    Read the article

  • javascript inherance? with Private vars and methods too

    - by Totty
    Hy i need to inherent a class from another. Parent has private var "_data" and private method "_test" and public method "add" Now the child have a public method "add", that uses the private method from the parent "_test" and the private var "_data". How do i do this? var Parent = function(){ var _data = {}; var _test = function(){alert('test')}; this.add = function(){alert('add from parent')} } var Child = function(){ this.add = function(){// here uses the _data and _test from the Parent class alert('add from child') } } // something to inherent Child from Parent // instance Child and use the add method And i think im miss the prototype concept (http://stackoverflow.com/questions/892467/javascript-inheritance)

    Read the article

  • What does this JavaScript error mean?

    - by Tommy
    Using the “Venkman” JavaScript debugger for Mozilla and getting the following error: XML Parsing Error: not well-formed Location: x-jsd:source?location=http%3A%2F%2F192.168.1.150%2Fscript.js&instance=337 Line Number 557, Column 50:<line><margin x='t'> - </margin><num> 554</num> ?? valid = false;</line> Functions works but I don't understand the error. Any help is appreciated. Thanks. function ValidateCheckBoxes() { var valid; $(document).ready(function(){ if($('input[@name=boxesA]:checked').size() == 0) {     valid = false; } else { valid = true; } }); return valid; }

    Read the article

  • IE JavaScript Mystery

    - by William Calleja
    I have the following JavaScript function function headerBanner(){ var current = $('.bannerImages img:nth-child('+bannerIndex+')').css('display', 'none'); if(bannerIndex== $('.bannerImages img').size()){ bannerIndex= 1; }else{ bannerIndex= (bannerIndex*1)+1; } var next = $('.bannerImages img:nth-child('+bannerIndex+')').css('display', 'block'); } In every browser on the planet, with the exception of IE (8, 7 or less), the above code is working correctly. In Internet Explorer it's going through it and having no effect. I've put alerts at every line of the function and they all fire, even in IE, but the banner simply doesn't change. Is there any reason as to why this is so?

    Read the article

  • Are closures in javascript recompiled

    - by Discodancer
    Let's say we have this code (forget about prototypes for a moment): function A(){ var foo = 1; this.method = function(){ return foo; } } var a = new A(); is the inner function recompiled each time the function A is run? Or is it better (and why) to do it like this: function method = function(){ return this.foo; } function A(){ this.foo = 1; this.method = method; } var a = new A(); Or are the javascript engines smart enough not to create a new 'method' function every time? Specifically Google's v8 and node.js. Also, any general recommendations on when to use which technique are welcome. In my specific example, it really suits me to use the first example, but I know thath the outer function will be instantiated many times.

    Read the article

  • Security / Protecting code in JavaScript

    - by Evans
    With all the recent hype about JavaScript and HTML5 replacing Flash, I wanted to know - How would it be possible to protect client-side js code? Of course, it is possible to obfuscate it, but that would only make it a little harder. Also, for games which submit high scores to the server, wouldn't it be incredibly easy to modify those scores before they are sent to the server? I know even Flash files can be decompiled, but they can be obfuscated and flash decompilation is not as easy as modifying data in JS - could be done easily using a plugin such as Firebug. I'd like to know everyone's views on this.

    Read the article

  • Unicode and URI encoding, decoding and escaping in JavaScript

    - by apphacker
    If you look at this table here, it has a list of escape sequences for Unicode characters that don't actually work for me. For example for "%96", which should be a –, I get an error when trying decode: decodeURIComponent("%96"); URIError: URI malformed If I attempt to encode "–" I actually get: encodeURIComponent("–"); "%E2%80%93" I searched through the internet and I saw this page, which mentions using escape and unescape with decodeURIComponent and encodeURIComponent respectively. This doesn't seem to help because %96 doesn't show up as "–" no matter what I try and this of course wouldn't work: decodeURIComponent(escape("%96)); "%96" Not very helpful. How can I get "%96" to be a "–" with JavaScript (without hardcoding a map for every single possible unicode character I may run into)?

    Read the article

  • Can any JavaScript library perform as well as the Cut The Rope JavaScript implementation?

    - by joe
    Now that the canvas tag is starting to get hardware execration [acceleration - thanks guys!] by many browsers, developing casual games in HTML5 is becoming more feasible. ZeptoLabs did a great job porting Cut The Rope to HTML5 for use as a Windows 8 Metro App. You can find some of the details here but they do not get into specifics. I was wondering if anyone knew if they used a library (such as Impact or Crafty) or if you need to write all custom and optimized JavaScript code in order to get this type of performance. Thanks!

    Read the article

  • dynamically insert javascript into <head> tag.

    - by James123
    I am using CEWP (webpart) and putting this code in there. But this code is not going inside <head> tag. I need to insert this code in <head> tag, <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $("*").each(function () { if ($(this).children().length == 0) { $(this).text($(this).text().replace('Respuesta','Responder')); } }); </script> How can I do this? How this code will work in CEWP webpart?

    Read the article

  • Javascript src starts with //?

    - by Chris
    I'm starting to see more and more script references show up like so: <script type="text/javascript" src="//somedomain.com/somescript.js"></script> Note the lack of http: at the beginning of the src attribute. It seems to work fine and avoids the messy requirement of detecting http vs https, but I've never actually seen this uri format referenced anywhere. Where did it come from? Is this behavior documented anywhere? Is it guaranteed to work in any browser?

    Read the article

  • javascript filter nested object based on key value

    - by murray3
    I wish to filter a nested javascript object by the value of the "step" key: var data = { "name": "Root", "step": 1, "id": "0.0", "children": [ { "name": "first level child 1", "id": "0.1", "step":2, "children": [ { "name": "second level child 1", "id": "0.1.1", "step": 3, "children": [ { "name": "third level child 1", "id": "0.1.1.1", "step": 4, "children": []}, { "name": "third level child 2", "id": "0.1.1.2", "step": 5, "children": []} ]}, ]} ] }; var subdata = data.children.filter(function (d) { return (d.step <= 2)}); This just returns the unmodified nested object, even if I put value of filter to 1. does .filter work on nested objects or do I need to roll my own function here, advise and correct code appreciated. cjm

    Read the article

  • Beginners question: Variable in Javascript

    - by Andreas
    Hello everybody! I'm new to javascript and cant get this little thing to work. (all external scripts a of course loaded) I have this jQuery script: $('a.Link').click(function(){ autoComp('City'); }); function autoComp(strFormName) { var Company = 'Adobe Apple Microsoft'.split(" "); var City = 'London Paris Berlin'.split(" "); $('#'+strFormName).autocomplete(strFormName) } I cant get it to work. I've discovered that the problem is the last "strFormName" after .autocomplete Appreciate all the help I can get.

    Read the article

  • Javascript Regex multiple group matches in pattern

    - by mummybot
    I have a question for a Javascript regex ninja: How could I simplify my variable creation from a string using regex? I currently have it working without using any grouping, but I would love to see a better way! The string is: var url = 'resources/css/main.css?detect=#information{width:300px;}'; The code that works is: var styleStr = /[^=]+$/.exec(url).toString(); var id = /[^\#][^\{]+/.exec(styleStr).toString(); var property = /[^\{]+/.exec(/[^\#\w][^\:]+/.exec(styleStr)).toString(); var value = /[^\:]+/.exec(/[^\#\w\{][^\:]+[^\;\}]/.exec(styleStr)).toString(); This gives: alert(id) //information alert(property) //width alert(value) //300px Any takers?

    Read the article

  • standard debugging way for javascript/jquery

    - by ZX12R
    This is my usual way to debug javascript. Include alert(0); to break the flow and find out what is happening. sometimes when i need multiple check points i do alert('the flow is now in function 1'); alert('the flow is now in function 2'); or sometimes just alert('success'); i would like to know if there is any standard way for debugging adopted as i am finding my current method very intrusive. thanks in advance..:)

    Read the article

  • Javascript alert instead of redirect in PHP mail script

    - by JCHASE11
    Thanks to Col. Shrapnel I am using a VERY basic PHP script to send emails. The form is located here. This is the script: <?php mail('[email protected]','Live Date Submission',implode("\n\n",$_POST)); header("Location: thankyou.html"); ?> When a user submits the form, they are redirected to a thankyou.html page. I want to edit the code to display a javascript alert, instead of a redirect. I don't have much PHP knowledge, so how would I edit this code to return a alert instead of a redirect?

    Read the article

  • Passing a JavaScript variable to a helper method

    - by Brendan Vogt
    I am using ASP.NET MVC 3 and the YUI library. I created my own helper method to redirect to an edit view by passing in the item's ID from the Model as such: window.location = '@Url.RouteUrl(Url.NewsEdit(@Model.NewsId))'; Now I am busy populating my YUI data table and would like to call my helper method like above, not sure if it is possible because I get the item's ID by JavaScript like: var formatActionLinks = function (oCell, oRecord, oColumn, oData) { var newsId = oRecord.getData('NewsId'); oCell.innerHTML = '<a href="/News/Edit/' + newsId + '">Edit</a>'; };

    Read the article

  • Javascript Number Random Scrambler

    - by stjowa
    Hi, I need a Javascript random number scrambler for my website. Seems simple, but I can not figure out how to do it. Can anyone help me out? I have the following array of numbers: 1 2 3 4 5 6 7 8 9 I would like to be able to have these numbers scrambled randomly. Like the following: 3 6 4 2 9 5 1 8 7 or 4 1 7 3 5 9 2 6 8 So, specifically, I would like a function that takes in an array of numbers (1 - n) and then returns that same array of numbers - scrambled randomly with different calls to the function. Maybe a noob function, but can't seem to figure it out. Thanks!

    Read the article

  • How to eval javascript code with iPhone SDK?

    - by overboming
    I need to fetch some result on a webpage, which use some javascript code to generate the part I am interesting in like following eval(function(p,a,c,k,e,d){e=function(c){return c};if(!''.replace(/^/,String)){while(c--)d[c]=k[c]||c;k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('5 11=17;5 12=["/3/2/1/0/13.4","/3/2/1/0/15.4","/3/2/1/0/14.4","/3/2/1/0/7.4","/3/2/1/0/6.4","/3/2/1/0/8.4","/3/2/1/0/10.4","/3/2/1/0/9.4","/3/2/1/0/23.4","/3/2/1/0/22.4","/3/2/1/0/24.4","/3/2/1/0/26.4","/3/2/1/0/25.4","/3/2/1/0/18.4","/3/2/1/0/16.4","/3/2/1/0/19.4","/3/2/1/0/21.4"];5 20=0;',10,27,'40769|54|Images|Files|png|var|imanhua_005_140430179|imanhua_004_140430179|imanhua_006_140430226|imanhua_008_140430242|imanhua_007_140430226|len|pic|imanhua_001_140429664|imanhua_003_140430117|imanhua_002_140430070|imanhua_015_140430414||imanhua_014_140430382|imanhua_016_140430414|sid|imanhua_017_140430429|imanhua_010_140430289|imanhua_009_140430242|imanhua_011_140430367|imanhua_013_140430382|imanhua_012_140430367'.split('|'),0,{})) How do I get the evaluation output?

    Read the article

  • Global javascript variable inside ready

    - by w0rldart
    Which is the right way of declaring a global javascript variable? The way I'm trying it, doesn't work $(document).ready(function() { var intro; if ($('.intro_check').is(':checked')) { intro = true; $('.intro').wrap('<div class="disabled"></div>'); }; $('.intro_check').change(function(){ if(this.checked) { intro = false; $('.enabled').removeClass('enabled').addClass('disabled'); } else { intro = true; if($('.intro').exists()) { $('.disabled').removeClass('disabled').addClass('enabled'); } else { $('.intro').wrap('<div class="disabled"></div>'); } } }); }); console.log(intro);

    Read the article

  • Property value of a String object in JavaScript

    - by naivists
    As far as I understand, every string is an object in Javascript. Still, it "does not work" as I expect it to be: var a="abc"; //here we get a new string object a.b = 123; //I seem to declare a property "b" of that object alert(a.b); //alerts "undefined" However, if I try to define a string in the "wrong way", everything works as expected var a=new String("abc"); // a.b = 123; alert(a.b); //alerts "123" Why is that so?

    Read the article

  • Run PHP class from JavaScript

    - by jarus
    I need to fire a php class from a javascript function. code: <input type="button" name="Submit" value="Submit" class="opinionbox" onclick="verifyControl('<?=$control_no?>')"/> function verifyControl(rNo) { Cont_no=document.getElementById("ContNo").value; if(rNo==Cont_no) { frames['frame1'].print(); showPage('payment'); } else if(rNo!=Cont_no) { alert("invalid control no"); } } i need to run the code $data = $obj_com -> getSelectedData('tbl', 'control_no', $contno); $control_no = $contno; $obj_com -> recordPay('tbl',$contno); inside the verifyControl() how can I do this?

    Read the article

  • javascript __doPostBack doesn't seem to work for me...

    - by Pandiya Chendur
    I use yui datatable in my asp.net application... I have a link button in one of my columns and it works fine but doesn't do a postback of a hidden button... myDataTable.subscribe("linkClickEvent", function(oArgs) { javascript: __doPostBack('ctl00_ContentPlaceHolder1_Button1', ''); YAHOO.util.Event.stopEvent(oArgs.event); }); and in my page <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" style="display:none;" /> protected void Button1_Click(object sender, EventArgs e) { DownloadFile(Hfhref.Value, true); } I used break point but it doesn't seem to get the __dopostback.. Any suggestion...

    Read the article

  • JavaScript Namespace Declaration

    - by Hery
    I created a javascript class as follow: var MyClass = (function() { function myprivate(param) { console.log(param); } return { MyPublic : function(param) { myprivate(param); } }; })(); MyClass.MyPublic("hello"); The code above is working, but my question is, how if I want to introduce namespace to that class. Basically I want to be able to call the class like this: Namespace.MyClass.MyPublic("Hello World"); If I added Namespace.MyClass, it'll throw error "Syntax Error". I did try to add "window.Namespace = {}" and it doesn't work either. Thanks.. :)

    Read the article

< Previous Page | 111 112 113 114 115 116 117 118 119 120 121 122  | Next Page >