Search javascript

136304 results
3

votes
1

answer

JavaScript debugger in JavaScript

I am looking for a JavaScript JavaScript debugger. The situation is as follows: I am making a JS game engine. The AI scripts as well as various other actions are implemented in JS. It is possible, from the engine's developer mode, to edit this code from the browser itself (using Ace). Now I want to...
MasterScrat
1

votes
1

answer

Javascript Module in Javascript

Ok the problem is simple. I want use two JavaScript files: one following the module pattern and another one that calls the firs one. I tested all the code using Node.js. When all the code is in one file it works but if I split the code in two files I get an error. Here's the code: // module.js var...
cicciosgamino
1

votes
1

answer

javascript, Javascript bug

Run in console next code setTimeout(function(){ console.log(1); }, 2); console.log(2); setTimeout(function(){ console.log(3); }, 1); Why 4 values when has only 3? console
bzenkobogdan
4

votes
1

answer

Dynamically load JavaScript with JavaScript

After over an hour of trying to get it to work I'm thinking it's because of cross domain policies, but I really thought this would work. I can't find a lot of info on it either. But, here is my issue. I have a site called http://mysite.com and then I include a 3rd party script (what im writing) and...
Oscar Godson
1

votes
2

answer

Insert JavaScript code from JavaScript

i need gets a html code by jsonp like method, and display this on a div element. This works with simple html like an images, text, etc. But now the code can content a JavaScript tags and need insert this on a div, but the javascript, don't runs, i resume it with a example: var div = document.getElem...
Exos
2

votes
4

answer

Dynamically insert javascript using Javascript?

I am trying to dynamically insert a set of script tags with some javascript code in it using javascript. I am basically trying to wrap a file in jwplayer, but the script string is breaking rest of the javascript code in the page. How do I do this correctly? the line causing the problem: $file_link_i...
user794846
4

votes
1

answer

JavaScript preloader of more JavaScript

I've seen a few tutorials on how to create a JavaScript preloader for images. Is it possible to use a JavaScript preloader for other JavaScript? My website uses mootools (and others too) for animations and a copious amount of pictures, etc -- therefore it takes awhile to load. Is it possible for t...
captainandcoke
1

votes
2

answer

JavaScript Moveable Divs with JavaScript

I want to make some funny movable divs. I have the following codes: dragElement(document.getElementById('draggable_shortcut')); function dragElement(elmnt) { var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0; if (document.getElementById(elmnt.id + 'top-content')) { /* if present, the header is where yo...
Manuel
1

votes
1

answer

Javascript in HAML in Javascript

I've got a question that mightve been asked before but i have trouble finding a proper description. I hope someone can help me out. In the code below on the line where i set var price i want to add the javascript variable accu_id to find a record in my DB through rails. How do I do this in embedded...
Daniel B
1

votes
2

answer

Properly formatting JavaScript in JavaScript

How can I automatically format JavaScript properly? As an example, this: (function(){(function(){alert('whatever')})()})() Should become: (function(){ (function(){ alert('whatever') })() })()
Tanner Ottinger
67

votes
9

answer

JavaScript parser in JavaScript [closed]

I need to add some lightweight syntactic sugar to JavaScript source code, and process it using a JavaScript-based build system. Are there any open source JavaScript parsers written in JavaScript? And are they reasonably fast when run on top of V8 or a similar high-performance JavaScript implementati...
emk
4

votes
4

answer

JavaScript: mouseenter event in JavaScript?

Is there a mouse enter event in javascript(only JavaScript, no jQuery to be used, please)? When I do this, it gives no response. window.onload = initAll; function initAll(){ if(window.addEventListener){ document.getElementById('container').addEventListener( 'mouseenter', freeze , false); } } functio...
Navneet Saini
2

votes
3

answer

JavaScript syntax check with JavaScript?

How could a Commando like me check if inputed code is a valid JavaScript source using some JavaScript built-in methods (if any!) or in any other possible way!? (Something like a preparser found in various IDE's like NetBeans, Eclipse, etc)? I have to check if code is OKAY and then window.eval()-it t...
1

votes
2

answer

Javascript - Drag and clone Javascript

Sorry I'm a newb at this ... looking to click on a picture and drag it into another div but keeping the original picture in the same position and state. I had a go at this but failed! Thanks in advance for the help. $('.userprofilepic').draggable({ helper: 'clone'});
stevenpjm
1

votes
2

answer

Inline Javascript to Unobtrusive JavaScript?

How can I channge this inline javascript to Unobtrusive JavaScript? Thank you! Thank you for your answears, but it doesn't work. My codes are: php js file document.getElementById('button1').onclick = function(){ this.value = this.value === 'Text1' ? 'Text2' : 'Text1'; } or document.getElementById('b...
tolias63
1

votes
1

answer

javascript validation - Javascript not running

I'm trying to validate the inputs, so far I've created only two rules. One to test the phone number and another to test if the passwords entered at the same. My problem is that for some reason my javascript isn't validating input. I have it referenced in , I call it in the form onsubmit='return val...
Comp Pass
0

votes
3

answer

Javascript function in Eloquent Javascript

How does greaterThanTen(9) become the y variable in the return function? What I mean is how does the parameter (9) become the y in the return function argument? Wouldn't 9 be replaced with x since greaterThanTen = greaterThan(10)? Wouldn't the 9 just replace the x = 10 parameter? I just don't unders...
Vodka_Tonic
3

votes
1

answer

Remove unnecessary JavaScript using JavaScript

I've a page in an ASP.net site where i've multiple content placeholders, script tags with JavaScript functions and others elements. I'm hiding all content holders and other html elements using JavaScript except a div which i want to display. But i get the other scripts running in that page. How can...
NLV
1

votes
4

answer

JavaScript - Repeat only javascript code

So I have code that repeats my function forever, although when I make that happen the rest of my site repeats itself too. So When I try to type in text box it does not let me. And when I hover over things they blink. How can I fix this? Code: window.onload = function () { setInterval(function () { f...
csf30816
1

votes
1

answer

Adding javascript within javascript which loads another javascript

I want to dynamically add a javascript tag, whose src points to an external source, whose result will generate some other javascript. That javascript will draw external data, a table for football teams. If I include it with document.write it works fine. var everysport_u='http://puff.everysport.com/t...
H.Rabiee
3

votes
2

answer

Alert Javascript Errors when javascript fails?

When I have a fatal error in javascript making the app not usable, like this one: SyntaxError: Unexpected token '}' Is it possible to catch it and display it somehow? like replacing the body or alerting? So in other words, a way to run javascript code if there is a javascript code error... I can't o...
Vincent Duprez
3

votes
6

answer

Real Time Javascript Event Tracking (Javascript Stats)

There are lots of real time web stats services on the web (w3counter-histats-gostats).They just count once when page is requested , But what I want to do is track javascript functions/events, because my website is fully-ajax.So I want something like google analytic's event tracker (http://code.googl...
Oguz Bilgic
4

votes
2

answer

Writing a javascript file from another javascript

I have two web pages. On the first page I have to submit a form. Using the values from the form (using embedded javascript), I need to generate another javascript file and use this generated javascript file in the next page. How can this be done? Or is there a better way of doing this?
Ankur Ankan
2

votes
2

answer

Load JavaScript file inside another JavaScript file

I'm using node.js and socket.io and doing a server/client thing. On my Server, is since its' not on a webpage, is there a way I can load the latest file (or latest jQuery?) so I can use jQuery functions inside my Server js file. Thanks
nn2
3

votes
2

answer

Import JavaScript file from within JavaScript synchronously?

Instead of messing up my HTML file, I'd like to import my external JavaScript files through another JavaScript file, much like @import in css. On several websites, including StackOverflow itself, I noticed that appending a script tag to the DOM can solve this issue; however, this is done asynchronuo...
pimvdb
3

votes
3

answer

Difference between application/javascript and text/javascript

I was reading a tutorial on HTML 5 Canvas Animation with javascript (of course). In the header, the author used application/javascript which is rather new to me because I've only seen text/javascript used. Can anyone help? There is every likelihood this question has been asked before but I'm using a...
afaolek
3

votes
4

answer

Insert javascript into javascript html return

I've got an HTML table that's being returned using javascript return function. It works perfectly until I try to add an additional if clause into the middle of it. function format ( d ) { return ''+ ''+ ''+ 'Save'+ ''+ ''+ 'Customer'+ ''+d.customer+''+ 'Value'+ if (d.country !== 'usd') { ''+d.v...
Brian Powell
3

votes
2

answer

JavaScript vs No JavaScript links and forms

A few days ago I posted this question: My last question about ajax link vs normal link It was about making links work for JavaScript enable browser (AJAX) and normal link for non-JavaScript browsers or crawlers. Now I found that this method work for me and is also recommended by Google. This is what...
MadeInDreams
3

votes
1

answer

Javascript Regex for Javascript Regex and Digits

The title might seem a bit recursive, and indeed it is. I am working on a Javascript which can highlight/color Javascript code displayed in HTML. Thus, in the Internet Browser, comments will be turned green, definitions (for, if, while, etc.) will be turned a dark blue and italic, numbers will be re...
Kafoso
2

votes
2

answer

Moving inline Javascript to External Combined Javascript

Hi There I am busy moving all my inline javascripts to a combined.js file. In my header I have the code below. I am working in wordpress. The code below makes a slider function on my page. I have already moved the bulk part of the javascript to a combined js file. (function($){jssor_slider1_starter...
Gerald Ferreira
2

votes
4

answer

JavaScript Array Initialisation in Simple JavaScript Inheritance

I'm currently working on some code based on John Resig -Simple JavaScript Inheritance. And i'm having some trouble with the initialization of arrays. If i put an array as an attribute for an object and don't initialize the array during the call of init(), all the modification made to the array like...
Py.
2

votes
2

answer

Show javascript Alert without blocking javascript

On page load, I am starting a timer to check if session is expired. I am checking expiry by making ajax call to a page. I need to display alert 5 minutes before expiry and redirect to default page after expiry. Here is my code: function startSessionCheckTimer() { setInterval(checkSessionExpiry, 6000...
Tushar Kesare
33

votes
6

answer

Is it JavaScript or Javascript? [closed]

I know this isn't programming-related, but I'm curious what this community thinks about the subject. My understanding is that JavaScript is what the language is named. Lately, it seems to have become trendy to write it Javascript. Who are we to rename the language? I'm interested to hear if there is...
Andrew Hedges
1

votes
2

answer

JavaScript script tag in a JavaScript String

I have the same issue as here: Script tag in JavaScript string However I can not resolve the issue with the proposed solutions. I'm using datatables plugin for jquery. I tried different solutions from above thread but none work. I get a '$ is not defined' error.If I set var html to like 'test' it wo...
beginner_
1

votes
4

answer

Javascript and performance, use jQuery or Javascript?

I have a big data should be shown in a Table. I use javascript to fill the table instead of priting in HTML. Here is a sample data I use: var aUsersData = [[1, 'John Smith', '....'],[...],.......]; the problem is that Firefox warns me that 'There is a heavy script running, should i continue or stop?...
Alexar
1

votes
4

answer

Execute local Javascript after remote javascript loads?

I have a page where I am using jquery/ajax to pull down a chunk of HTML/JS from another component and injecting it into the page. That HTML references additional JS files, and I need those referenced JS files to be loaded before I run my javascript. The HTML/JS that is being injected looks somethin...
Mike Mooney
2

votes
2

answer

Javascript: what is this javascript feature

I'm reading a react sample project. Here is the reducer code: export const COUNTER_INCREMENT = 'COUNTER_INCREMENT'; export const COUNTER_DOUBLE_ASYNC = 'COUNTER_DOUBLE_ASYNC'; // ------------------------------------ // Action Handlers // ------------------------------------ const ACTION_HANDLERS = {...
15

votes
7

answer

Lazy loading JavaScript and Inline JavaScript

I noticed in the of my site (for work), there are a lot of and tags. There are even more JavaScript/CSS files that are only loaded for specific pages (we're using CodeIgniter, and the file paths are passed to the header view). I was considering using a conditional/asynchronous loader (eg. yepnop...
Rocket Hazmat
36

votes
1

answer

text/javascript vs application/javascript [duplicate]

This question already has an answer here: What is the javascript MIME type for the type attribute of a script tag? [duplicate] 5 answers I am curious about the semantics of the MIME types application/javascript versus text/javascript. Obviously, one is supposed to be executed, and the other is su...
sircapsalot
266

votes
5

answer

Javascript .map files - javascript source maps

Recently I have seen files with .js.map extension shipped with some JavaScript libraries (like Angular), and that just raised few questions in my head: What is it for? Why do the guys at Angular care to deliver a .js.map file? How can I (as a JavaScript developer) use the angular.min.js.map file? Sh...
Muhammad Reda