javascript

How to use jQuery .each() - I get a value, but it's the wrong one

I am returning a JSON object (as a String) through a servlet. The JSON object looks like this: {"3":"Martin Luther","30":"Boris Becker","32":"Joseph Goebels","19":"Leonardo Da Vinci","31":"Adolf Hitler"} My jQuery looks like this (the submission of data is correct because I get a proper looking result from the servlet): $.ajax( { ...

Showing right sub-ul of parent ul menu

Hello, i have this html menu: <ul id='main'> <li class='active current' id='lighty'> <a href='/'>Lighty</a> <ul> <li class='sub'> <a href='/'>Hem</a> </li> </ul> </li> <li id='community'> <a href='/community'>Community</a> ...

Undefined vs window.undefined in JavaScript

Can someone explain way this work if(window.a){} while this is failing if(a) In both cases a is undefined. ...

JavaScript Same Origin Policy - How does it apply to different subdomains?

How does the Same Origin Policy apply to the following two domains? http://server1.MyDomain.com http://server2.MyDomain.com Can I run JS on a page hosted on server1, if the content is retreived from server2? edit according to Daniel's answer below, I can include scripts between different subdomains using the <script> tag, but what ab...

Javascript Regular Expression matching

Hello, By using the pattern from here, I want to check while a user fills in the #id_phone text input field, if it is matching to the pattern, use the value of #id_phone to fill #id_new_phone's value. This doesn't seem to work for me. $('#id_phone').change(function() { var myPattern = new RegExp(^0\(5\d{2}\) \d{3} \d{2} \d{2}$); ...

How to make a secure game in javascript ?

Hello, I'm working on games using javascript some html and css, and I was wondering if there was any way to secure the game so that the user can't just call game.php?result=victory to finish the game and earn some point. As of right now here are the solution I have. For a chance game, start the page with the result already in place, ...

Implementations of JavaScript stream ciphers?

Are there any free to use implementations of stream ciphers available for JavaScript? Especially interested in HC-128, Salsa20/12 or SOSEMANUK as these are recommended by The eSTREAM Project ...

Google maps api v3 - multiple markers, multiple infowindows, 3 icons

Hello, I wanna made "WiFi maps" and I have problem with do that, I wanna have 3 icons OPEN/WEP/WPA, and a lot of markers, and every marker with own infowindow, and only 1 infowindow on top, so when I will click #1 and then #2 then #1 will hide. And if I will have XXXX markers there will be problem with them on map in zoom out, there is p...

Cannot select/edit TineMCE-generated table

I'm currently using TinyMCE edit in my drupal-website, problem is that beneath the editor, some of the table is sticking out. If I remove the height set by javascript with firebug, it looks fine, even after resizing. So I want to remove the height with JS, I've put this function at the end of my page: $('table#edit-body_tbl').removeAt...

What is more viable to use? Javascript libraries or UI Programming tools?

What is more viable to use:- Javascript Libraries: YUI, jQuery, ExtJs OR UI Programming tools: GWT, ExtGWT, SmartGWT It has become very difficult to choose between them as they are constantly increasing their capabilities to meet newer requirements. We all know the power of jQuery in UI manipulations. The latest news from Micro...

How to do a javascript redirection to a ClickOnce deployment URL?

I have a ClickOnce application used to view some documents on a website. When connected, the user sees a list of documents as links to http://server/myapp.application?document=docname. It worked fine until I had to integrate the website authentication/security system into my application. The website uses a ticketing system to grant acces...

How to know when a pop-down menu needs to be closed

I'm experimenting with pop-down menus (inside floating DIVs). Making them appear with onmouseover attributes is no problem, but I'm not sure how I can make the menu close properly. I'm dealing with an image that has links mapped over it with <map>. I want people to see a menu when hovering over a link. I figured the best way to know wh...

how i can know the width of div element

How do I get the width in pixels of a HTML <div> element in javascript? ...

find the position of the cursor where user have clicked and display one div where user have clicked.

Hi all, I want to determine the position of the cursor where user have clicked. And display one div at bottom side of the page where user have clicked. For example on stack over flow home page if some one click on the logo. Then the div should be displayed at the bottom position of the logo. Same way if i click on the bottom link th...

Ajax time created combobox not enabled for dom manipulation in ie6

I make an async request in a web where the response is parsed into a select field where the option gets selected when dom node are ready, it's all ok in all navigators but with internet explorer 6 things gets weirder. I logged all events in ie with scripts of my own getting a variable null assigned, but when i do a alert with it it gets...

i want easy Javascript code to change textarea value upon <select><option>

Hi please help me, I have some textarea data which needs to be changed when the user select different option from a <select>. can you please give me some javascript easy code to do that please i don't want jquery things ...

Web Crawling Sites with Javascripts or web forms

Hello everyone, I have a webcrawler application. It successfully crawled most common and simple sites. Now i ran into some types of websites wherein HTML documents are dynamically generated through FORMS or javascripts. I believe they can be crawled and I just don't know how. Now, these websites do not show the actual HTML page. I mean i...

How to make Chrome redraw SVG dynamically added content?

I've dynamacally added the circle elements to the svg displayed in a iFrame. Chrome isnt showing the new elements, not tried FF yet. Is there somekind of redraw/refresh I need to call? The first circle is actually in the svg document, the rest come from script. <iframe id="svgFrame" src="xmlfile1.svg" width="300" height="300"> <svg xmln...

Help with animating an element in jQuery

I have an unordered list with a few list elements. #tags { width: 300px; height: 300px; position: relative; border: 1px solid red; list-style: none none; } #tags li { position: absolute; background: gray; } I have also started writing a jQuery plugin to animate the list elements. So far, I place the li...

i cant call the function in prototype .js ? where i m doing mistake in my code help

Code: DeCheBX = $('MyDiv').insert(new Element('input', { 'type': 'checkbox', 'id': "Img" + obj[i].Nam, 'value': obj[i].IM, 'onClick': SayHi(id) })); document.body.appendChild(DeCheBX); DeImg = $('MyDiv').insert(new Element('img', { 'id': "Imgx" + obj[i].Nam, 'src': obj[i]...