javascript

Permission denied on IE using window.open()?

Hello all, IE is giving me a permission denied error when I use window.open to open a window from a browser button. I do not get the error in Firefox or Chrome. What do I do? The code: <button type="button" onClick="window.open('https://www.example.com','newWindow');"&gt; My button </button> ...

What is the equivalent of getBoundingClientRect on iPhone Mobile Safari?

iPhone Mobile Safari seems to be missing element.getBoundingClientRect. What is the equivalent method on iPhone Mobile Safari? This method exists on the iPad. ...

jQuery Autocomplete problem - Shift Key behaves same as Return Key

See: http://www.airbnb.com/ In the search bar, start typing "san f" (no quotes, all lowercase), then hit Return (or Enter). "San Francisco" is autocompleted. This is good! Now clear the search field and start over. type "San F" and boom - "San Francisco" is autocompleted as soon as you hit Shift. This is not expected. This happens in ...

missing : after property id javascript error in geolocation

Can anyone see a problem with the following i hope its a simple snag but its driving me mad.. firebug brings up the 'missing : after property id' - I have looked online but cant suss it any thoughts..? navigator.geolocation.getCurrentPosition(function(position){ var lat = position.coords.latitude; var lon = position.coords.long...

Lightweight web browser for testing

I have e very specific test setup in mind. I would like to start a web-browser that understands Javascript and can use HTTP proxy, point it to a URL (ideally by specifying it in the command line along with the proxy config), wait for the page to load while listening (in the proxy) requests are generated as web-page is rendered and Javasc...

Javascript Getting a string into kb format

I am new to javascript and I just wanted to convert a string into a format that a person like me can read. Here is an example of what I am trying to do... string2size(string){ //some awesome coding I have no clue how to make return awesomeAnswer } now the return should give me something like 56 bytes or 12kb or 1mb depending how much...

How do you move html from one div to another with Jquery without breaking javascript

I have two divs for different sections of my webpage, a working and a reference section. One is fixed size, the other is variable sized and they are vertically stacked. I am trying to design it so that if you want to work on something in the reference pane, you click a link and it swaps all the data between the two panes. My idea was ...

HTML form -> Flash submit button -> Set a PHP variable in flash button -> Submit form

Okay, I'm sorry that this is pretty complicated, but it shouldn't be that hard to solve... Here's what I want to do. I have an HTML form that I want to upload to MySQL with PHP. That part's easy, but the thing is I want the submit button to be a Flash object. Somehow I need the Flash button to submit the form, but I think I can figure t...

Using Jquery to get JSON objects from local file.

I'm trying to get a list of JSON objects (products) from a local file using Jquery and store all the objects in a single array called allItems. The file is co-located in the same directory as the code, and it's called "allItems.json". Here's how I'm doing it now: function getAllSupportedItems(){ var allItems = new Array(); $.g...

How to change img src string from ending with _m to _t using jquery for a set of images

Hello guys, I was hoping to get a nice push in the right direction I would like to change the ending of my images sources string... i hope i worded that right. Anyway my current src's are reading: <img src="something/something/12345_m.jpg" /> I would like to change it to: <img src="something/something/12345_t.jpg" /> Any idea guy...

button in XSL for AJAX usage

Hi guys, I wonder if its is possible to do AJAX when I put a button inside the xsl file; <input type = "button" id="laptop" value = "Add to Cart" onclick="sendCartRequest('Add');" /> That's what I do in my xsl file then in my js file I pass the id to the DOM and try to alert it make sure it is passed. And the alert appear to be empt...

Is it possible to get the referrer of an iFrame's parent page with JavaScript in iFrame?

Is it possible to get the referrer of an iFrame's parent page with JavaScript in iFrame? Example: Page A has an iFrame. The iFrames referrer is be page A. But is is possible to get Page A's referrer in the iFrame with JavaScript? ...

How can I simply change the Timezone Offset with Zend_Date?

I'm using Zend_Date to manage dates/times in a scheduling app. The only way I'm able to determine the user's Timezone is via Javascript which only gives a Timezone Offset. Zend_Date only seems to take Timezones in the 'America/New_York' format. Is there a way to get the users timezone in this format or set the Timezone Offset with Ze...

Getting $_POST variable from table

I'm trying to build a sort of resource allocation form. I'd like to be able to print a table from a database, and then allow users to click on each cell that they would like to reserve. Also, being able to drag and select multiple cells. Then send all of this via $_POST to another php script. Problem is, I have no idea where to start. ...

How to do live update on section of page?

I need to refresh sections of my page to update when there is new data! what do i do? use jquery? examples: ...

website doesn't use flash so what is it using?

Hey guys just been looking at the Steam website and noticed it doesnt use Flash. What technologies are being used to create the page? For example the slide bar to scroll through the different games, how exactly is that happening? Thanks in advance for any replys. ...

How do I sort a hash table in javascript?

I have a javascript hash table, like so: var things = [ ]; things["hello"] = {"name" : "zzz I fell asleep", "number" : 7}; things["one"] = {"name" : "something", "number" : 18}; things["two"] = {"name" : "another thing", "number" : -2}; I want to sort these into order by name, so if I iterate through the hash table it will go in order...

Regex javascript to match href

Hello, <u class="logout" href="/logout.php?h=970c9836674709e6dcdaadd094622fc5&t=1273295318" target="_top">Logout</u> That above is what I want to search for. I want to get h= and t= from that URL, or just get the entire url in href="" How would I do this with regex? ...

Determine image src in onload and onerror event handlers in IE

How can I determine the image src of the image that triggered the event in the onload and onerror event handlers in IE? This example code I threw together: <script language="javascript" type="text/javascript" src="jquery.js"></script> <script language="javascript" type="text/javascript"> function loadImages() { var goodImage = new I...

Assigning property to JS object using another objects property value as the property name

Hey guys, I want to use the value of an objects property to name the property of another object. Easy to do in PHP: $object1->property = 'name'; $object2->{$object1->property} = "value"; echo $object2->name; //outputs "value" But in Javascript I can't figure out how to do this. The curly braces are used a different way. Anyone kno...