Search Results

Search found 23708 results on 949 pages for 'javascript'.

Page 29/949 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • Catch access to undefined property in JavaScript

    - by avri
    The Spider-Monkey JavaScript engine implements the noSuchMethod callback function for JavaScript Objects. This function is called whenever JavaScript tries to execute an undefined method of an Object. I would like to set a callback function to an Object that will be called whenever an undefined property in the Object is accessed or assigned to. I haven't found a noSuchProperty function implemented for JavaScript Objects and I am curios if there is any workaround that will achieve the same result. Consider the following code: var a = {}; a.__defineGetter__("bla", function(){alert(1);return 2;}); alert(a.bla); It is equivalent to [alert(1);alert(2)] - even though a.bla is undefined. I would like to achieve the same result but to unknown properties (i.e. without knowing in advance that a."bla" will be the property accessed)

    Read the article

  • Learning Javascript in one weekend?

    - by dueyfinster
    Similiar to this question, I am wondering if experienced Javascript developers have any websites they use with examples to get the basics of Javascript down in 24/28 hours? I have looked at Douglas Crockford's Google Tech Talk and I bought the book "Javascript: the good parts" but I haven't had time to read it.

    Read the article

  • Library to write javascript code

    - by Melursus
    Is there a c# library that can help to write and indent Javascript code. It's because I'm writing some c# code that generated some Javascript code. Something like this : js += "<script type=\"text/javascript\">\n"; js += " function()...\n"; And I find that generated a lot of ugly code. So, I thought that maybe a existing library can help me doing that ?

    Read the article

  • Lexer written in Javascript?

    - by Phobis
    I have a project where a user needs to define a set of instructions for a ui that is completely written in javascript. I need to have the ability to parse a string of instructions and then translate them into instructions. Is there any libraries out there for parsing that are 100% javascript? Or a generator that will generate in javascript? Thanks!

    Read the article

  • Setting hidden input value in Javascript, then accessing it in c# codebehind

    - by Siegesmith
    Thank you for reading my question. I have been trying to set the value of a hidden input by using Javascript and then access the value from within my C# codebehind. When I run the code that is copied below, the value that is assigned to assignedIDs is "", which I assume is the default value for a hidden input. If I manually set the value in the html tag, then assignedIDs is set to that value. This behavior suggests to me that the value of the input is being reset (re-rendered?) between the onClientClick and onClick events firing. I would appreciate any help with the matter. I have spent hours trying to solve what seems like a very simple problem. html/javascript: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Admin Page - Manage Tasks</title> <script language="javascript" type="text/javascript"> function PopulateAssignedIDHiddenInput() { var source = document.getElementById('assignedLinguistListBox'); var s = ""; var count = source.length; for (var i = count - 1; i >= 0; i--) { var item = source.options[i]; if (s == "") { s = source.options[i].value; } else { s = s.concat(",",source.options[i].value); } } document.getElementById('assignedIDHiddenInput').Value = s; // I have confirmed that, at this point, the value of // the hidden input is set properly } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Panel id="EditMode" runat="server"> <table style="border: none;"> <tr> <td> <asp:Label ID="availableLinguistLabel" runat="server" Text="Available"></asp:Label><br /> <asp:ListBox ID="availableLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> <td> <input type="button" name="right" value="&gt;&gt;" onclick="Javascript:MoveItem('availableLinguistListBox', 'assignedLinguistListBox');" /><br /><br /> <input type="button" name="left" value="&lt;&lt;" onclick="Javascript:MoveItem('assignedLinguistListBox', 'availableLinguistListBox');" /> </td> <td> <asp:Label ID="assignedLinguistLabel" runat="server" Text="Assigned To"></asp:Label><br /> <asp:ListBox ID="assignedLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> </tr> </table> //-snip- <asp:Button ID="save_task_changes_button" runat="server" ToolTip="Click to save changes to task" Text="Save Changes" OnClick="save_task_changes_button_click" OnClientClick="Javascript:PopulateAssignedIDHiddenInput()" /> </asp:Panel> <!-- Hidden Inputs --> <!-- Note that I have also tried setting runat="server" with no change --> <input id="assignedIDHiddenInput" name="assignedIDHiddenInput" type="hidden" /> </div> </form> </body> c# protected void save_task_changes_button_click(object sender, EventArgs e) { string assignedIDs = Request.Form["assignedIDHiddenInput"]; // Here, assignedIDs == ""; also, Request.Params["assignedIDHiddenInput"] == "" // -snip- }

    Read the article

  • Jquery code breaks page Javascript

    - by Graham
    I required a function to remove URLs from <a> divs found within <div class="rj_insertcode">. Not being familiar with with direction to tackle this, I eventually mustered up the following Jquery code: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('div.rj_insertcode a').each(function() { $(this).replaceWith($(this).html()); }); }); </script> </head> My site uses Joomla CMS and I was able to add the above script to the bottom of the template index.php. It works quite well and removes the links generated between the defined tags. My problem: Pages that also include JavaScript do not operate correctly. JavaScript appears to be disabled or not functioning. What can I change to ensure JavaScript still operates correctly, or is there another method I could adopt?

    Read the article

  • Custom Context Menu with Javascript?

    - by viatropos
    Is there a way to add custom fields to the built in browser context menu using Javascript? I know flash/actionscript can do this, how are they doing it? Example: right click on http://josephjewell.com and see the custom context menu. Is this possible with pure javascript or do you have to use flash? Note, I'm looking for adding to the built in browser context menu, not using custom javascript popups to mimic them.

    Read the article

  • greasemonkey insert javascript

    - by Kaartz
    I have a bookmarklet, clicking the bookmarklet includes a PHP script (evaluated as a JavaScript file) to the page few table values and select values passed as GET parameters. The PHP script writes the page data to the MySQL database, and outputs a success message that is treated as JavaScript code and executed by the browser. Is there any possibility to do this using greasemonkey and call this function when a existing button is clicked on the web page. I wrote the above bookmarklet inspired by this tutorial. http://tutorialzine.com/2010/04/simple-bookmarking-app-php-javascript-mysql/ This is the bookmarklet code: (function () { var jsScript = document.createElement('script'); jsScript.setAttribute('type', 'text/javascript'); jsScript.setAttribute('src', '/bookmark.php?url=' + encodeURIComponent(location.href) + '&title=' + encodeURIComponent(document.title)); document.getElementsByTagName('head')[0].appendChild(jsScript); })(); Please help me.

    Read the article

  • Validate site/domain via javascript

    - by Chez
    I have a standard html form where the user can specify a website/domain: favourite website: [ ] I expect the user to type things like: [www.google.com] [www.yahoo.com] [www.example.co.jp] I want to validate the domain/site via javascript so if a user had typed something wrong: [www...google.com] [www.-example.com] I tell them straight away. Can anybody post this javascript ? Alternatively can anybody point me to a site where I can look at their javascript ? Many Thanks

    Read the article

  • Using external javascript files with asp.net MVC

    - by twal
    I have some javascript inwhich I am using such helpers as var url = <%=ResolveUrl("~/controller/action") %> When the javascript is embeded in the .aspx page using the <script> tag everything works fine When I move it out to an external file those scripts that have the helper methods do not work. Other scripts do just the ones with the var url = <%=ResolveUrl("~/controller/action") %> do not. Are these not possible to use in external javascript files?? I would like to get all of my javascript out of the aspx files if I can. thanks!

    Read the article

  • Setting hidden input value in Javascript, then accessing it in codebehind

    - by Siegesmith
    I have been trying to set the value of a hidden input by using Javascript and then access the value from within my C# codebehind. When I run the code that is copied below, the value that is assigned to assignedIDs is "", which I assume is the default value for a hidden input. If I manually set the value in the html tag, then assignedIDs is set to that value. This behavior suggests to me that the value of the input is being reset (re-rendered?) between the onClientClick and onClick events firing. I would appreciate any help with the matter. I have spent hours trying to solve what seems like a very simple problem. html/javascript: <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Admin Page - Manage Tasks</title> <script language="javascript" type="text/javascript"> function PopulateAssignedIDHiddenInput() { var source = document.getElementById('assignedLinguistListBox'); var s = ""; var count = source.length; for (var i = count - 1; i >= 0; i--) { var item = source.options[i]; if (s == "") { s = source.options[i].value; } else { s = s.concat(",",source.options[i].value); } } document.getElementById('assignedIDHiddenInput').Value = s; // I have confirmed that, at this point, the value of // the hidden input is set properly } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:Panel id="EditMode" runat="server"> <table style="border: none;"> <tr> <td> <asp:Label ID="availableLinguistLabel" runat="server" Text="Available"></asp:Label><br /> <asp:ListBox ID="availableLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> <td> <input type="button" name="right" value="&gt;&gt;" onclick="Javascript:MoveItem('availableLinguistListBox', 'assignedLinguistListBox');" /><br /><br /> <input type="button" name="left" value="&lt;&lt;" onclick="Javascript:MoveItem('assignedLinguistListBox', 'availableLinguistListBox');" /> </td> <td> <asp:Label ID="assignedLinguistLabel" runat="server" Text="Assigned To"></asp:Label><br /> <asp:ListBox ID="assignedLinguistListBox" runat="server" Rows="10" SelectionMode="Multiple"></asp:ListBox> </td> </tr> </table> //-snip- <asp:Button ID="save_task_changes_button" runat="server" ToolTip="Click to save changes to task" Text="Save Changes" OnClick="save_task_changes_button_click" OnClientClick="Javascript:PopulateAssignedIDHiddenInput()" /> </asp:Panel> <!-- Hidden Inputs --> <!-- Note that I have also tried setting runat="server" with no change --> <input id="assignedIDHiddenInput" name="assignedIDHiddenInput" type="hidden" /> </div> </form> </body> c# protected void save_task_changes_button_click(object sender, EventArgs e) { string assignedIDs = Request.Form["assignedIDHiddenInput"]; // Here, assignedIDs == ""; also, Request.Params["assignedIDHiddenInput"] == "" // -snip- }

    Read the article

  • How to import php with javascript?

    - by dcp3450
    I know JavaScript is client side and PHP is server-side. I also know this is an odd question. However, the CMS editor I'm using will not allow php to be stored to the database (it's the same editor used by Dupral). I can store JavaScript though. Can I import a php file with JavaScript. Or rather read the php file, store the content in a variable then out put the content to the screen?

    Read the article

  • Improving Javascript Load Times - Concatenation vs Many + Cache

    - by El Yobo
    I'm wondering which of the following is going to result in better performance for a page which loads a large amount of javascript (jQuery + jQuery UI + various other javascript files). I have gone through most of the YSlow and Google Page Speed stuff, but am left wondering about a particular detail. A key thing for me here is that the site I'm working on is not on the public net; it's a business to business platform where almost all users are repeat visitors (and therefore with caches of the data, which is something that YSlow assumes will not be the case for a large number of visitors). First up, the standard approach recommended by tools such as YSlow is to concatenate it, compress it, and serve it up in a single file loaded at the end of your page. This approach sounds reasonably effective, but I think that a key part of the reasoning here is to improve performance for users without cached data. The system I currently have is something like this * All javascript files are compressed and loaded at the bottom of the page * All javascript files have far future cache expiration dates, so will remain (for most users) in the cache for a long time * Pages only load the javascript files that they require, rather than loading one monolithic file, most of which will not be required Now, my understanding is that, if the cache expiration date for a javascript file has not been reached, then the cached version is used immediately; there is no HTTP request sent at to the server at all. If this is correct, I would assume that having multiple tags is not causing any performance penalty, as I'm still not having any additional requests on most pages (recalling from above that almost all users have populated caches). In addition to this, not loading the JS means that the browser doesn't have to interpret or execute all this additional code which it isn't going to need; as a B2B application, most of our users are unfortunately stuck with IE6 and its painfully slow JS engine. Another benefit is that, when code changes, only the affected files need to be fetched again, rather than the whole set (granted, it would only need to be fetched once, so this is not so much of a benefit). I'm also looking at using LabJS to allow for parallel loading of the JS when it's not cached. So, what do people think is a better approach? In a similar vein, what do you think about a similar approach to CSS - is monolithic better?

    Read the article

  • Invalid Argument javascript error only on certain computers

    - by Jen
    Getting an error whenever we click a particular button/link on our site. It is generating a javascript "Invalid Argument" error. I know in the other posts it is typically because it is a syntax error in the javascript however it only just seems to have started happening and it doesn't happen on all pcs. ie. in our client's environment if I remote onto their web server and view the uat website I get the javascript error. If I remote onto their sql server and view the uat website I don't get the javascript error. If it was a syntax error then I would always get the error wouldn't I? both browsers are the same version of IE6 (yeah I know...) :) I have tried deleting temporary internet files - including viewing the files and deleting them myself - but no joy. client uses citrix.. and they're all getting the error :( Any ideas would be appreciated - Thanks! :) Update - Sorry I haven't posted specific code as there is too much to post (and I'm not sure where the error is occurring). The "button" launches a new window which in turn opens up a couple of aspx pages and calls lots of javascript. So the window opens ok, and there's a function that gets called to resize the window - but before it calls the resizing of the window/content it throws the invalid argument error. Am busy trying to get alerts to trigger to see if I can see where it's falling over but so far no luck. Again not sure why this error doesn't occur when I use a particular PC (same browser version)

    Read the article

  • What are the likely main reasons my website is very slow on IE?

    - by Bhupi
    Hi, I need to know what can be the main reasons (apart from the basics like grouping CSS selectors, reducing image size, using image sprite etc.) which makes a website slow on Internet Explorer, because my website works fine on the others like FF, chrome etc. Is it the huge use of Javascript framework (ie. jQuery, extjs, prototype)? Is it because of the use of plugins based on JS framework? Should I use core javascript and remove the use of any js framework? Should I try to avoid using jQuery(document).ready()? in case of jQuery framework? Above some of the questions which I know and please answer the questions which I couldn't ask because of lesser knowledge about these. I need to make my website perform well on IE (6,7,8) also please suggest. Thanks

    Read the article

  • asp net javascript Cache clear

    - by Florim Maxhuni
    I have a website that i did some time ago now they request some new features and i did some changes in some javascript files, but when i publish the clients that use the IE have problems with cache so in they browser they have old version of javascript. How can i clear the client cache so when they visit website they use latest javascript files that i modify.

    Read the article

  • jQuery question from a person who can't javascript

    - by Evilalan
    So I'm trying to adapt this Dropdown menu on Joomla the styles work great as expected so I'll post the javascript includes on the head of my website: <script type='text/javascript' src='js/jquery.js'></script> <script type='text/javascript' src='js/dropdown.js'></script> <script type='text/javascript'> $(function() { $('.menu').droppy(); }); </script> <script type='text/javascript'> $(function() { $('.menu').droppy({speed: 100}); }); </script> ok I don't know why its is not working I'll post the dropdown.js should I post the jQuery too? it's really big! $.fn.droppy = function(options) { options = $.extend({speed: 250}, options || {}); this.each(function() { var root = this, zIndex = 1000; function getSubnav(ele) { if (ele.nodeName.toLowerCase() == 'li') { var subnav = $('> ul', ele); return subnav.length ? subnav[0] : null; } else { return ele; } } function getActuator(ele) { if (ele.nodeName.toLowerCase() == 'ul') { return $(ele).parents('li')[0]; } else { return ele; } } function hide() { var subnav = getSubnav(this); if (!subnav) return; $.data(subnav, 'cancelHide', false); setTimeout(function() { if (!$.data(subnav, 'cancelHide')) { $(subnav).slideUp(options.speed); } }, 500); } function show() { var subnav = getSubnav(this); if (!subnav) return; $.data(subnav, 'cancelHide', true); $(subnav).css({zIndex: zIndex++}).slideDown(options.speed); if (this.nodeName.toLowerCase() == 'ul') { var li = getActuator(this); $(li).addClass('hover'); $('> a', li).addClass('hover'); } } $('ul, li', this).hover(show, hide); $('li', this).hover( function() { $(this).addClass('hover'); $('> a', this).addClass('hover'); }, function() { $(this).removeClass('hover'); $('> a', this).removeClass('hover'); } ); }); }; My question here is: Why is it not working! I know that this is really complex (I don't anything about JavaScript) but if you help me I'll post a tutorial and edited files that will help a lot of people! By the way I've download jQuery from the original site so I don't think that this can be the problem! Thanks in advance!

    Read the article

  • How to find the width of the div or check wheather horizontal scroll apeear or not?

    - by Salil
    I want to print the page (div) if there is no horizontal scroll appear for that div. I have a div (1000px) with dynamic data which having property overflow:auto;. So, i want to print the div only if div's width is not getting crossed. to achieve this i used following method of a javascript var curr_width = parseInt(mydiv.style.width); But it gives 1000px; only althogh i can see horizontal scrollbar for the div. What should i do to achive this. Can i check wheather horizontal scrollbar is appear for the div or not. Any help is appreciated. NOTE:- i don't want to use any javascript library.

    Read the article

  • Accessing property of object vs variable in javascript

    - by Samuel
    Why when I try to access a variable that don't exist, javascript throw an exception but when I try to access a property that don't exist in an object, javascript returns an undefined object? For example, this case returns an undefined object: function Foo(){ console.log(this.bar); } Foo(); But, in this other example, javascript throw an exception: function Foo(){ console.log(bar); } Foo(); ReferenceError: bar is not defined

    Read the article

  • Is html/javascript equivalent to as3/flex?

    - by DJ.
    Hello my fellow coders, As i notice for a while now (like everybody else in the industry), the RIA market is shifting from AS3/Flex to HTML/Javascript. What i would like to know is? Is html/javascript as powerfull as as3/Flex or are they entirely different. With other words can i build the exact same applictions with HTML(4/5) and Javascript as i can do with AS3/Flex? I'm not looking for the speed comparison? or bashing one technology over the other? I just want to know if is good for me to dive into javascript, JQuery...... PS. If there is a nother post on stackoverflow with the exacte question. please share the link. Thanks. Thank you.

    Read the article

  • Override default javascript functionality with jQuery

    - by deth4uall
    I am trying to overwrite a JavaScript on change event in the below code with jQuery however I believe that the inline JavaScript is taking priority over the jQuery functionality declared. Essentially I am trying to have an AJAX version of my site which includes an additional JavaScript file. I need this functionality to still work without the additional AJAX version, but I am not sure as to whether I should include it in the main JavaScript file or leave it inline like it is right now. Any suggestions and information regarding them would be greatly appreciated! Thanks! <form action="/cityhall/villages/" method="post" name="submit_village"> <select name="village" onchange="document.submit_village.submit();"> <option value=""></option> </select> </form> I am trying to use the jQuery Form Plugin to submit the posts to the PHP to handle the requests as follows: var bank_load_options = { target: '#content', beforeSubmit: showRequest, success: showResponse }; $('form.get_pages').livequery(function(){ $(this).ajaxForm(bank_load_options); return false; }); I modified the code as following: <form action="/cityhall/villages/" method="post" id="submit_village" name="submit_village"> <select name="village" class="get_pages" rel="submit_village"> <option value=""></option> </select> </form> <script> # main JavaScript $('.get_pages').live('change',function(e){ var submit_page = $(this).attr('rel'); $("#"+submit_page).submit(); }); # ajax JavaScript var bank_load_options = { target: '#content', beforeSubmit: showRequest, success: showResponse }; $('.get_pages').live('change',function(){ var submit_page = $(this).attr('rel'); $("#"+submit_page).ajaxForm(get_pages_load_options); return false; }); </script> However now it only runs every other option when I change it.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >