javascript

How can I implement prepend and append with regular Javascript?

How can I implement prepend and append with regular Javascript without using jQuery? ...

Problem when requesting a form using prototype on internet explorer 8

I'm trying to make a request using prototype 1.6.1 on ie 8, the following code works on Firefox: var myForm = document.forms[0]; myForm.request({ onSuccess: function(transport) { var url = getPath() + nomeAcao+'?modulo='+modulo; window.location = url; } }); When debugging, i get an error on t...

How do I scan JSON with jquery to determine the number of instances of a certain string?

Hi, I have some JSON which looks generally like this... {"appJSON": [ { "title":"Application Title", "category":"Business", "industry":"Retail", "language":"English", "tags":[ {"tags":"Sales"},{"tags":"Reporting"},{"tags":"Transportation"},{"tags":"Hospitality"} ], }, { "title":"Airline Quality Assurance", ... ... .....

Decode some injected Javascript?

I had the following injected into the footer of a site of mine and, in an effort of solving the greater mystery ("How" it happened), I'm trying to decode it. Any ideas? Here's the code: <ads><script type="text/javascript">document.write(unescape('%3C%73%63%72%69%70%74%20%6C%61%6E%67%75%61%67%65%3D%22%6A%61%76%61%73%63%72%69%70%74%22%20...

loop through list with sublists javascript

Hi I have next ul li1 li2 ul3 li3.1 li3.2 ul3.3 ul3.3.1 ul3.3.2 li4 li5 and I must check all items in ul3 I can't be sure if there is only two or three or more lists ...

what is wrong with this getelementsbyclassname call in javascript

Hello I am trying to access the width of a div to put in a cookie. This is the div: <div class="tab_panel" style="width:600px"> It is the only div with this class name. It is not an option to specify a unique id for the div. This is the code I have been using in an event to call it but it gives an error document.getElementsByClassN...

Custom alert using Javascript

How can I create a custom alert function in Javascript? ...

Cropper ratio formula

Hi I am using the YUI Image cropper to, well crop images. I have the cropper all set up ok. I am now setting the cropper's width's and height vars to defined values that fit my website structure. I have the cropper set up so that a small resized version of the original is shown with the cropper attached to that. Now, my problem is dete...

How to add a string to a text area with different colours?

Hello all, I am trying to work out how to write a function where I pass in a string and this string is added to a textarea. This I can do, but I want to parse that string and change the colour on different parts of the string. In other words, find the words "select", "where" and turn them blue. Then find the words "AND", "OR", "<" and ...

Dynamically creating a json index won't let me access the data within

I'm trying to use jQuery to send an ajax request to a very simple PHP script to load images for the jQuery cycle plugin. I'm having an issue with obtaining the image source strings from my json object. I'll show my code, then go into more detail below: <!doctype html> <html lang="en-us"> <head> <title>jQuery Cycle test</ti...

javascript performance between thin client and pc

I have a web app using thin clients (bosanova terminals) as the front end for users. I've noticed some performance differences in JavaScript between the thin client and a PC. The terminals are running windows XP embedded with IE6, and the pages I'm referring to are utilizing prototype JS framework to do some rather simple validation on...

Help Deobfuscate This JS attack.

Hi All, I have a piece of nasty javascript that I would like to de-obfuscate. I know that I can spin up a VM and behold the malware in all of its glory, but I am more interested in not having it run, but viewing it in a non-obfuscated form. If it needs to run in order to do this, then so be it, I guess. Anyone know how to do this wit...

Using localStorage in IE9 preview

I'm using localStorage in my JS application and I was wondering why IE9 claims localStorage == undefined. As far as I know, IE8 supports it, is here any way to get it working in the new version? ...

Referencing other properties in {} object creation

How do I do the following: var object = { alpha: 'one', beta: **alpha's value** } without splitting the object creation into two parts? ...

Find nested HTML form on an Asp.net page

I have a nested form in an asp.net page. This nested form is a login/password which I will pass over to another application. I need to submit the nested form using javascipt. However I am having trouble getting a reference to the nested form. // this is not working for me: document.forms[1]submit(); The nested form is a plain html fo...

Weird Bubbling Issue

I'm not sure why this is bubbling, but it is. Wondering if anyone has any ideas? $('#file_upload').live('submit',function(event){ $('#file_upload').attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid')); $('iframe').load(function(){ $('.upload_output').empty(); ...

variable input to javascript function parameter within a JSP page

I have the following function call inside a jsp page. jQuery(function($){ $("#product").mask("99/99/9999",{placeholder:" "}); }); What I want to do is pass a different string into the .mask function. In pseudo code it would look something along the lines of: String passedParam= someString if(test): passedParam = "someotherStri...

How do I switch off this part of CK editor?

How do I switch off this bottom bit? Can't seem to find it in the docs, can do just about everything else... config.??? = false; Answers on a postcard boys and girls. :D ...

Scope and Asynchronous JavaScript

I recently ran into an issue at work in which, at least according to my knowledge of JavaScript, I got back an impossible result. I'm hoping someone can explain whats going on here and why the actual results differ from my expected results. Expected results in console id: a , x: 1 id: b , x: 1 id: c , x: 1 Actual results in console ...

Adjust width of input field to its input

<html> <head> </head> <body> <input type="text" value="1" style="min-width:1px;" /> </body> </html> This is my code and it is not working. Is there any other way in HTML, JavaScript, PHP or CSS to set minimum width? Clarification by Marcel: The OP wants a text input field with a dynamically changing width, so that the inpu...