javascript

Can't appendChild to a node created from another frame

I have a page with an iframe and would like to extract a DOM node from the child frame and put it on the parent page. This works in Firefox (3.5), but not in Internet Explorer (7). I've broken down the code to the simplest I can. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict...

Form input loses focus on scroll bar click in IE

Hello everyone, I hope someone can help me. I know this has been discussed here before but the example is prototype and foreign to me. I'm looking for a strict javascript or jquery solution. I have an example setup here. Click on the scrollbar in FF and you don't get an alert but click on it in IE and you do. Please help me, thanks! ...

Undefined index pass variable with javascript to php

Hello. I am making an "updating" pages with JS jquery.. But in my updateit.php i just get Undefined index on all my fields. I dont know why. Here's the form: <form action="javascript:updateit()" method="post"> <b>+ Giv points for at være online:</b><br> Points hvert. <input type="text" size="1" id="gpe" name="gpe" value="<?=$row["gpe...

Getting JQuery to act on class name dynamically added by GWT

Hello, I'm trying to get jquery to do some ui affects for me while using GWT. I have notifications that I add to a page that when clicked should disappear. Since there could be multiple notifications of the same type (warning, error, etc.) I'm trying to dynamically add a style name only when they are clicked through GWT and then hav...

Rails accessing a view partial via the browser url

I've got some javascript that needs to load a rails partial - I'd prefer not to repeat the partial's HTML in the javascript file. Is there a way to make this partial accessible via the browser url so JS can load it? partial location: shared/_search.html.erb I would like to grab the view html with something like this: example.com...

Assign javascript function to a dom element

hi, i'm using the mshtml library for parsing out html via MSHTML.HTMLDocument. my question: is there a way to assign a javascript function to a dom element? i've tried something like: div.onmouseover = "function(){alert('mouseover')}" and div.setattribute "onmouseover" , "function(){alert('mouseover')}" without success (no error ...

jQuery: how to filter out non-character keys on keypress event?

I tried searching but unsure of what terms to look for. I'm using jQuery and would like to use the keypress event in a textbox, but prevent all non-printable characters (ie. Enter, ESC, arrow keys, backspace, tab, ctrl, insert, F1-F12, etc) from triggering the event. Is there an easy way to determine if it is printable? ...

Simply jQuery $.get call to twitter failing

I'm trying to write my first ever bit of AJAX, reading the public tmeline from Twitter. I have the following bits of code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Javascript Twitter ...

Change style of all elements of a class via prototype javascript

This is probably really simple, but the prototype docs on the $$(function) really suck. What do I DO with all the items once the function gives them to me? First I tried: $$('div.category').style.height = 400 +"px"; Then: $$('div.category').each(.style.height = 400 +"px"); Finally: for (x in $$('div.category')) { x.style.heig...

Javascript reduction loop doesnt work

OK its late so I must be doing something stupid, but myreduction for loop which works fine in c# does not work in javascript. The loop is NEVER entered. What have I missed? var count = 12; var j = count - 3 for (i = count; i<1 ; i--) { if (i % 3 == 0) break; else j = i - 1; } alert(j)...

problems with password field in EXT 3.0

I am having problems with a password field because it doesn't shows properly the emptytext that I pass through the config object, here is my code: {xtype: 'textfield', inputType: 'password', emptyText: '//Password', width: 200} the problem is that the EmptyText looks like a password too and ...

How to sell and protect software that has easily visible source (like Javascript)?

I have a unique idea for a browser based application that I'm considering developing and selling. The only problem is that it would all be HTML/Javascript based code. It is not a web-based service that I would host and others would use. It is something that clients would purchase and use either on their own local server or even on their ...

Back Button enabled deep-linking in IE

This is a problem that SWFAddress have fixed. But essentially, I'd like to write my own solution that strips out a lot of unused functions. Explanation below: You can use the following code to get the hash value of the an URL link like this xxx.xxx.com/?#/DeepLinking/ window.location.hash Using anchor tags with href='#tab1...etc. an...

ajax and no forms, what will happen?

I notice my site does not have a single <form> with the exception of logging in. I am not sure how or why it happened but i found i use jquery and ajax to post everything then refresh (or not if i dont need to). How and why would the user suffer from this? Some of my 'forms' include Leaving a comment on a page Removing messages Send...

Event listener loop

how do i add a listener for hovering over div tags like this: | btn1 | btn2 | btn3 | btn4 | i want to add a listener that loops through them like i show below and then applies a function if it has mouseover. function listen() { for (i=1;i<=10;i++) { wat = document.getElementById('btn'+i); wat.addEventListener('mouseover',functi...

Problem with CSS postion: relative with position: absolute children

Usually this sort of thing I can do, but today it is bugging me. See this page at JSbin. Essentially what I'm doing is have a list of unordered items they all have a link jQuery loops through and makes an extra link inside the list item, which is expanded to the whole list item using CSS this gives users a larger place to click For...

Selecting a random image from a flickr set and appending it to a div

I've run into a bit of a problem and was hoping to get a little help. I am trying to select a random image from a flickr set and append it to a div to use as a background image. Here is the function: $.getJSON("http://***", function (data){ ...

Creating a function from string which inherits the parent scope

In Javascript, is there a way to create a function from a string (such as through the new Function() constructor) and have it inherit the parent scope? For example: (function(){ function yay(){ } var blah = "super yay" yay.prototype.testy = new Function("alert(blah)") yay.prototype.hello = function(){alert(blah)} ...

using jquery, how do I check if an element is visible or not?

I also need to find out all the elements inside a div, and check for their visibility. How to do it? ...

Javascript building tree hierarchy

var array = [{"grandpa","father"}, {"father"}, {"grandpa","father","me"}]; Given the above array, I want to product a java-script object(JSON) like below, that has the parent-child like structure. {"id":"grandpa", "children":[ {"id":"father", "children":[ {"id":"me", "children":[] }] }] } ...