Splitting strings in JavaScript
I tried to split data as below, but the error "dat.split is not a function" displays. Anyone know how can I solve this problem? var dat = new Date("2009/12/12"); var r = dat.split('/'); ...
I tried to split data as below, but the error "dat.split is not a function" displays. Anyone know how can I solve this problem? var dat = new Date("2009/12/12"); var r = dat.split('/'); ...
I have a list of items, and each item has a quantity. var items = { 1: 12, // we have 12 x item1 2: 1, // we have 1 x item2 3: 1, 4: 7, 5: 2, 6: 2 }; Alternatively this could be viewed as: var items = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 4, 4, 4, 4, 4, 5, 5, 6, 6]; How would you...
Hi there, Does anyone know if a browser-independent debugger exists... For example I have been using Firebug in Firefox but if the web developers use other browsers - nothing. I was wondering if there is some kind of "global" debugger that can attach to any browser and just debug? Any ideas? ...
If I want to provide a widget on my website that other people can insert on their webpages, via : Can I import and use Jquery in that file so that the user doesn't need to add it manually to his page. How would I do this? (I'm new to Javascript too) Thanks ...
Hi! I have a div: <div style="test" id="someElement"></div> Is there any way to check if the certain element: $("#someElement") has a particular css style (in my case, "test"). Thank you very much! ...
I'm using the jQuery Autocomplete plugin. The strange problem I'm getting is with the lines that use in the plugin: list.scrollTop(...) Internet Explorer 8 (in all modes) claims it doesn't know this method. I've done a fix but I'm curious how this could slip past the developer. Is this new to IE8/IE7? ...
I'm using some external jQuery with $(document).ready() to insert adverts after the document ready event has fired, something like: $(document).ready($('#leaderboard').html("<strong>ad code</strong>"); This is to prevent the UI being blocked by the slow loading of the adverts. So far it's been working well. Now I need to insert some ...
hi all, My application's JavaScript is working on Firefox and IE but it is not working in Google Chrome. Is it problem of enable javascript in Google chrome? or I must put any code in javascript for getting XMLHttpRequest Object of Google chrome browser. ...
I need to close the tab which displays my webpage, by the click of a button. But firefox does not allow to close the window by javascript as long as it is not opened by javascript. If I set the value of dom.allow_scripts_to_close_windows to be "true", then even normal window.close() works too. But that is not a good solution. :( I tried...
Hi Guys, I wanted to add/remove values from the list box using javascript in struts2. How could I do that? Let's say I wanted to remove January from the list or add new month in list by javascript in struts2. how do I will implement it? Thanks in advance. Hiren ...
I'm looking for an example of how I would read a value from a database and use it in a jQuery script to set the background color of a control. I'm still learning jQuery, and it's not clear to me how to get a value from the database. I'm using ASP.NET MVC, and my form is already pulling the value - do I need to put it in a hidden field an...
I'm loading a string of HTML into a UIWebView through loadHTMLString. It produces a very long webpage. Once that string is loaded, I need to navigate to an HTML anchor tag with its "name" attribute set. In the HTML, I might have: //3 pages of text here <a name="go here"></a> lots more text here //another 3 pages of text here I need...
I have this code: function render_message(id) { var xmlHttp; xmlHttp=new XMLHttpRequest(); xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { document.getElementById('message').innerHTML=xmlHttp.responseText; document.getElementById('message').style.display=''; } } var url="inc...
I have a page that has 3 buttons on it, when a user clicks on a button it displays a model popup where the user inputs data etc. On the main page there is a dropdownlist which breaks through the model when it popups up, this is a known IE6 z-index bug. My workaround (after trying bgiframe) was to simply hide the dropdown whenever a pop...
This is a question in response to thise: http://stackoverflow.com/questions/760628/javascript-function-not-working-in-ie I need jQuery to do something like this: function render_message(id) { var xmlHttp; xmlHttp=new XMLHttpRequest(); xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4) { docume...
Hi, How can I rebind my events (jquery) when I perform a partial page postback? I am wiring everything up using: $(document).ready(function(){}; After a partial page postback, my events are not firing. ...
Hi, I have a website with a directory listing of all the pdf files which I have uploaded via ftp. By clicking any of the file names, the pdf document will show up in your web browser. Is it possible for outside parties to digitally signed the document in the web browser and save it back into the server with a appended "signed" on the fi...
I cant seem to get my JSON file to work when pulling it in from another domain using JQuerys getJSON. I have placed the callback part at the end of the url but still have no joy. Firebug tells me its a cross domain issue, which seems to make sense as if I place the json file locally the below code (excluding the ?jsoncallback=? works f...
Firstly, is there a way to use document.write() inside of JQuery's $(document).ready() method? If there is, please clue me in because that will resolve my issue. Otherwise, I have someone's code that I'm supposed to make work with mine. The catch is that I am not allowed to alter his code in any way. The part that doesn't work looks som...
If I have an array of image filenames, var preload = ["a.gif", "b.gif", "c.gif"]; and I want to preload them in a loop, is it necessary to create an image object each time? Will all the methods listed below work? Is one better? A. var image = new Image(); for (i = 0; i < preload.length; i++) { image.src = preload[i]; } B. var...