javascript

[JS] How to workaround same origin problem

Hi guys: The following JS will fail if the URL in mainFrame from a.abc.com to b.abc.com. top.frames["mainFrame"].location.href = "/Users/xuenn.aspx?backUrl=" + top.frames["mainFrame"].location.href.split("?")[0]; This is the error message: Permission denied for http://a.abc.com to get property Location.href from http://b.abc.com. Any...

getElementsByTagName does not return comment nodes in javascript

Hi , I want to retrieve all the nodes present in particular DIV element.see the below test page (firefox) <HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script> function processTa...

JavaScript change to DropDownList.SelectedIndex not submitted

Hi So, I have a form to submit fighters. You write his/her name, country, and then the team they fight for + the team's country. When you start typing the name I have constructed my own Ajax AutoCompleter. It will find existing fighters that might match. When you click on one of the suggestions it will populate up to four fields depen...

copy an element as HTML to clipboard

I've managed to write some jQuery to find an element and copy it's html to the clipboard (ie only). The problem is that when I paste this into a rich text box area in sharepoint it pastes the HTML as text only. How do i replicate the user action of highlighting a link on a page and pressing copy. When I do this manually and then paste...

Windows Desktop Gadget issue with IFRAME?

We're doing some preliminary explorations of Windows Desktop Gadgets here at our company and we've decided to try our first one simply by embedding an IFRAME inside the gadget HTML and pointing it to a web page we already have hosted on our intranet. The page on our intranet includes JQuery (whose calls seem to be working inside the pag...

I can't get datepicker to work

Hi, I need a field that displays the datepicker. I followed the example given by the JQuery UI documentation and haven't managed to get it to work. My html where I have my text field is: <div class="editor-field"> <input type = "text" name = "DatePublished" id = "Published" /> <%= Html.ValidationMessag...

Javascript: Add multiple Lighthbox galleries on same page

I am using a modified version of light house from this page. I want to add two instances of the same code to add two differrent slideshows on the same page. Is this possible? ...

Set focus to textbox after alert in Safari

I'm trying to return focus to the textbox after showing message. Like the following code: <input type="text" id="text1" /> <input type="submit" id="submit1" onclick="alert('test');document.getElementById('text1').focus();return false;" /> It's not working in Safari. I've got version 4.0.5 for Windows. ...

Javascript - Text Input Attributes

I need to create a form element <input disabled type="text" value="Shui Mu Tsinghua" /> which is disabled by default. It enables when onmouseover occures. onmouseover="this.disabled=false;" And is disabled by onmouseout onmouseout="this.disabled=true;" What I need is to check the following. If the <input> is focused t...

iphone web app: open directions in external maps application

I've seen the answers for opening the Maps app in a native iPhone app, but is there any way to do this in a web app? I've tried changing window.location to http://maps.google.com/maps?q=cupertino for example, to no avail. I've tried using a simple anchor tag linked to http://maps.google.com/maps?q=cupertino, also to no avail. Has anyone ...

Enter to reliably submit html form

I have a form with text input + gradient-shaded button with onclick='this.form.submit()' (plus some hidden inputs). In all browsers, clicking on the button works. In Firefox, if I click Enter while in text input, it submits the form. In IE, it does nothing. How can I make it work with IE? ...

How to use setTimeout / .delay() to wait for typing between characters

Hi all, I am creating a simple listbox filter that takes the user input and returns the matching results in a listbox via javascript/jquery (roughly 5000+ items in listbox). Here is the code snippet: var Listbox1 = $('#Listbox1'); var commands = document.getElementById('DatabaseCommandsHidden'); //using js for speed $('#CommandsFilter...

input URL, output contents of "view page source", i.e. after javascript / etc, library or command-line

I need a scalable, automated, method of dumping the contents of "view page source", after manipulation, to a file. This non-interactive method would be (more or less) identical to an army of humans navigating my list of URLs and dumping "view page source" to a file. Programs such as wget or curl will non-interactively retrieve a set of ...

Exception thrown in YUI: "Sizzle" is not defined!

Hi, We are using HTML Unit v2.6 with Web-Harvest and extended its functionality to create a new element <web session="sess1" browser="firefox2"> <web-getpage url="https://www.linkedin.com/secure/login"/&gt; <web-setinput name="uname">username</web-setinput> <web-setinput name="pwd">password</web-setinput> <web-clickinput name="login"/...

Extending Object in Javasript

I'm trying to extend Object functionality this way: Object.prototype.get_type = function() { if(this.constructor) { var r = /\W*function\s+([\w\$]+)\(/; var match = r.exec(this.constructor.toString()); return match ? match[1].toLowerCase() : undefined; } else { return typeof this; } } It'...

Display Facebook wall posts using the Javascript SDK

Hi, I'm having trouble using FB.Facebook.apiClient.stream_get (as in, I don't know how it works), but I have not been able to find clear instructions on how to use it to get all the posts made on the Wall of my fan page. Can someone provide me with some instruction? Thanks, much appreciated! Tom Nchinda ...

get days of a month in JS/Prototype

Hi, I´m looking for a function/prototype extension, which returns all days of a given month. I couldn't find anything helpful at the standard date() functions (http://www.w3schools.com/jsref/jsref_obj_date.asp). i.e.: getDays(2010-05) // returns something like: { day:'Saturday', date:'2010-01-05' }, { day:'Sunday', date:'2010-...

want to detect browser close event?

I am working on any application in which i need to detect that whether user close the tab or browser so I can disconnect the user from other user basically its an chat application. I have used :- window.onbeforeunload = confirmExit; function confirmExit() { if(needToConfirm) { return "Leaving this page will end your conve...

Mootools element returning null

I have this HTML/PHP <input name="add to list" class='fncAdd' id='moodal_close' value="add to list" onclick="cajaxUpdateCartProduct('<?= $value->id ?>', 'quantity_<?= $value->id ?>', '<?= $this->sitePfx ?>/cart/');" type="button"> In my javascript I have $('moodal_close').addEvent('click', function(){ alert("1"); }); In...

Microsoft JScript runtime error: 'null' is null or not an object

I have application like where i can create dynamic tabs. and delete cross bar option on tabs. When I am trying to delete the tab I am getting error like Microsoft JScript runtime error: 'null' is null or not an object and point to my Javascript code. Here is my JS code. <script type="text/javascript"> /* <![CDATA[ */ ...