javascript

jquery / javascript not picking up value on click

I need to dynamically alter a variable with the "name" attribute from a link - code below... <input type="text" class="datepicker" id="dp1"> <a href="javascript:;" class="tab" name="1,2">test button</a> and $(document).ready(function(){ var pickable = { dp1: [4,5,6] }; $(".tab").click(function () { v...

My dilemma involving JavaScript's Prototypal Inheritance and the hasOwnProperty method

Basically everyone writing about member enumeration in JavaScript heavily advocates the use of the hasOwnProperty method as to avoid going up the prototype-chain. I understand that this is a form of defensive programming as to prevent iterating over members that are added, for example, to the Object.prototype. But what about the other...

jQuery: Data on dynamic div's

In jQuery, I'm creating several div elements within a class: function class([..]) { this.par1 = par1 [..] // Create div $div = $('<div></div>') $div.attr({ 'id': 'someid' + this.par1, [..] }) // Assign data to $div $div.data['par1'] = this.par1 $div.data['this'] = this // Append to document $('#container...

Form "is undefined" error in Firefox

I have this code, let say it's a.html <form name="frmSubmit" id="frmSubmit" method="post"> <input type="hidden" name="hdnName" value="user name" /> </form> <script> // 1 : start document.frmSubmit.action = 'b.html'; document.frmSubmit.submit(); // 1 : end // 2 : start document.getElementById("frmSubmit").action = 'b.html'; document.ge...

overlay opaque div over youtube iframe :)

How can I overlay a div with semi-transparent opacity over a youtube iframe embedded video? <iframe class="youtube-player" type="text/html" width="520" height="330" src="http://www.youtube.com/embed/NWHfY_lvKIQ" frameborder="0"></iframe> <div id="overlay"></div> CSS #overlay { position:fixed; top:0; left:0; width:100%...

Iframe onload when downloading file

Hi there! I've been pulling my hair out for hours trying to figure this out. I have an iframe with which I want to download a file. It all works fine, but the iframe onload is not called if my Response.ContentType = "APPLICATION/OCTET-STREAM"; My javascript function is as follows: function DownloadStuff(){ var DownloadSource = "http:/...

Is there a way to use jQuery to simulate a user clicking on this div, to start playing the video contained within?

jsFiddle I have a DailyMotion video embedded in my page, through an iFrame, within a div. If the user clicks on the video, it starts playing. Is there a way to use jQuery to simulate the user clicking on the video, so that it will start playing automatically? From what I've read so far you can only use jQuery's click() with events atta...

Pinch Zoom in webview [Android]

Hello On my website, which is loaded in the webview, there is a map. There are also java scripts that detects double tap for zoom, dragging etc. But is it possible to have a javascript that detects the use of pinch zoom ? there are several examples of it working on an iphone, and on my website there is a script for the pinch zoom but it...

Need a basename function in Javascript

I need a short basename function (one-liner ?) for Javascript: basename("/a/folder/file.a.ext") -> "file.a" basename("/a/folder/file.ext") -> "file" basename("/a/folder/file") -> "file" That should strip the path and any extension. Update: For dot at the beginning would be nice to treat as "special" files basename("/a/folder/.file.a...

javascript objects cant see each other? :: google chrome extension

i have two files one called stats.js one called storage.html in stats.js in contains var stats = { myFunc : function() { //do something } } in storage.html I have <html> <head> <script src="stats.js"></script> <script> $(document).ready(function() { stats.myFunc(); }); </script> </head> </html> But I get Uncaugh...

Javascript Eval question

Hi all: Do you know the why the following code need to add "(" and ")" for eval? var strJson = eval("(" + $("#status").val().replace(";","") + ")"); PS: $("#status").val() returned is something like {"10000048":"1","25000175":"2","25000268":"3"}; Thank you. ...

jQuery and iPhone native app development.

How to use JqPlot (javascript ) charting libraries in a native application for iphone? ...

How to get the selected tab of the browser using javascript?

Hi all, How to get the selected tab of the browser using javascript? Thanks, Gaurav ...

Refresh Parent Window from child window in IE8

Hello I create a link with window.open, in new opened window i add a button for close window. I want when my window is close then parent window will refresh, so i use this script : window.opener.location.href="https://qa.bloom.com/products/customer/account/profile/"; window.close(); In my application parent window use secure serve...

Getting innerHTML text from selected checkboxes in Prototype

Hi, I need to get the text from the selected checkboxes in a form. Ifhe form is: <form action="save" method="post" name="reunform" id="reunform" > <div id="listad"> <ul id="litemsd"> <li class="litemd"><input type="checkbox" name="d1" />Number One</li> <li class="litemd"><input type="checkbox" name="d2" />Numer Two</li> <li ...

js form filling checking

How could i return user to unfilled field when he push "submit" button? I have something like this: <!--Contact Name--> <div class="section" id="inputdiv"> <span class="fieldname">Name:</span> <input type="text" id="contactname" /> <!-- Nessesary to be filled--> <script type="text/javascript"> ...

Is it possible for XHR HEAD requests to not follow redirects (301 302)

Is it possible to send an xhr HTTP HEAD request to only get header response for the first request and not automatically follow 301, 302 like redirects? I'm only interested in getting the new location of the url. Example: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function(data) { if (xhr.readyState == 4) { if (...

Error: uncaught exception: [Exception... "An invalid or illegal string was specified"

This two errors I get in the Firefox error console: Error: Incorrect document format Source file: Row 1, column 45 Source code: <div xmlns="http://www.w3.org/1999/xhtml"&gt;&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; Error: uncaught exception: [Exception... "An invalid or illegal st...

IE9 selectSingleNode missing from beta, how to overcome this in JavaScript?

XMLDocument object in Internet Explorer 9 does not contain definition for selectSingleNode Xpath-based traversal anymore. Of course, I googled a little and came across this thread, where it is unsure is it missing by specification or by the fact it is still "in beta". http://social.msdn.microsoft.com/Forums/en/iewebdevelopment/thread/0...

How to allow only "numbers","-" and "()" using JavaScript

Hello, I have to do phone number validation using JavaScript. I have already done validation for numbers as follows, var filter =/^[0-9]+$/ But now I have to also allow hyphen and "()". Please provide me a way for the same. ...