javascript

Javascript - Get element from within an iFrame.

I am trying to get a div from within an iframe and print it on my page. Any Ideas ? ...

Implementation Advice: How to upload to different server without reloading page

Hello all, I really need advice on how to do the following. I have tried several things and they have not worked. I would like to upload a video to viddler using their REST API. I wish to upload a video directly to them. However, I want to upload to them without reloading the page? How can I do this? I have tried AJAX with an iFram...

Javascript function results in HTML page reload: why?

Hi all, Newbie question... The objective: I intend to have an HTML text input field as a kind of command line input. An unordered HTML list shows the 5 most recent commands. Clicking on one of the last commands in this list should populate the command line input text field with the respective command (in order to re-execute or modify...

Repeating code block problem

I have the following code in a jQuery JavaScript document running on a page (THIS IS CURRENT): $(window).resize(function(){ detectscreen(); }); function windowWidth() { if(!window.innerWidth) { // user is being a git, using ie return document.documentElement.clientWidth; } else { return window.innerWidth; }} ...

The correct Javascript Date.parse(...) format string?

What is a culture-invariant way of constructing a string such that the Javascript Date() constructor can parse it and create the proper date object? I have tried these format strings which don't work (using C# to generate the strings): clientDate.ToString(); // gives: "11/05/2009 17:35:23 +00:00" clientDate.ToString("MMM' 'dd', 'yyyy'...

window.navigate and document.location issue

Hello, I am working on a system that after completing a record edit and returning control to the calling AJAX script, I refresh the calling page by calling a custom server extension. The odd behavior I am experiencing is after control is returned to the calling script, when the code hits window.navigate or document.location, it attempt...

Localize dates on a browser?

Let's say I have a date that I can represent in a culture-invariant format (ISO 8601). I'll pick July 6, 2009, 3:54 pm UTC time in Paris, a.k.a. 5:54 pm local time in Paris observing daylight savings. 2009-07-06T15:54:12.000+02:00 OK... is there any hidden gem of markup that will tell the browser to convert that string into a loca...

AJAXify site

Hello, I have legitimate reasons to do what I am trying to explain. I have an existing site say abc.com which has regular pages etc. everything written in php. Now I would like to AJAXify the site i.e. when a user clicks on a link, it should fetch the link using AJAX and replace the page contents. This is the easy part and I can achieve...

Accessing the JavaScript Table DOM in a Java Servlet

I want to write reusable code that takes an HTML table from a JSP and converts it to Excel format to be exported to the user. I want to take advantage of the HTML DOM Table Object rather than parse the HTML in Java to extract the same information. The biggest advantage to this would be inspecting each cell for checkboxes, buttons, etc....

jQuery - How to tell .hover() to wait?

Hello, just a short qustion .. I have a drop down menu. Now when it's slided down to multiple levels, I'd like it to add wait time for like 2 secs, before it disapears, so the user can get back in, when he breaks the .hover() by mistake ... Is it possible? my code for the slide: $('.icon').hover(function() { $('li.icon > ul').sli...

PDF Javascript export attachment

I'm looking for solution for exporting attachments from pdf and I find some interesting stuff here: http://www.acrobatusers.com/tutorials/importing-and-exporting-pdf-file-attachments-acrobat-javascript But, I have problem when using this code: this.exportDataObject({cName:"MyDoc", nLaunch:2}); I always get this error: TypeError: Inv...

Dijit widgets don't initialize if they are programatically created on IE6.

I'm using the classical JavaScript way (programatically) to instantiate dijit widgets with dojo-1.3.1, it works OK in Firefox but in IE wont initialize the widgets and it doesn't throw any error. My source code for this is: <html> <head> <title>...</title> <script type="text/javascript" src="lib/dojo/dojo/dojo.js" djconfig="parseOn...

At witt's end... Javascript won't replace '\n'!

Hey guys, I've been going at this problem for a solid couple hours now and having zero luck. No clue how this is even possible; I'll try to summarize. I'm using TinyMCE to insert new content to a DB, that content is being sent back as an AJAX response after it is inserted into the DB and then shown on the page, replacing some old cont...

undefined error when calling function from another js sourcefile

Hello, I have a question that concerns calling a function within another js sourcefile. I declared the sourcefile before the file with the function that calls that particular function. I thought this would work, but it gives an undefined error. I also have a function in a file that calls a function in a later declared sourcefile. Tha...

How to unescape html in javascript?

I'm working with a web service that will give me values like: var text = "&lt;&lt;&lt;&amp;&amp;&amp;"; And i need to print this to look like "<<<&&&" with javascript. But here's the catch: i can't use inner HTML(I'm actually sending this values to a prototype library that creates Text Nodes so it doesn't unescape my raw html strin...

How to set the function to make user click the table header to change sorting order

I want to let user click the table header to sort the table, but can just set the ascending order, can not set the descending order in the same table header. following is the function I used, function sortBy(sKey) { document.sortResultsForm.sSortBy.value=sKey; document.sortResultsForm.submit(); } function sortDistrictNamedescen...

add a <div> before 5th <li> and add another </div> after the last <li> from a list?

how can i make it possible say i have a unordered list of 17 items. so now i want to add a div tag just before the the 5th item and the closing div will go after the last item of the list. the result will look some thing like this. <ul> <li><img src="http://static.flickr.com/66/199481236_dc98b5abb3_s.jpg" width="75" height...

Using Javascript to open a "maximized" window in IE6?

Any idea for this? Problems encountered: Using screen.availHeight and screen.availWidth as the height and width params in window.open causes the browser size to include the taskbar, and positioning at (0, 0) ignores the possibility of the taskbar being up there. What I want is to open a new window with the size as if it was "maximized...

jquery draggable with safari 4

$(".droppable").droppable({ drop: function(event, ui) { var fileName = $(ui.draggable).attr("src").match(/[\/|\\]([^\\\/]+)$/); // get filename. var url = $("#hurl").val(); if ( $(ui.draggable).attr('name') == "template") url = $("#turl").val(); ...

Javascript: onScroll event (using Prototype) doesn't work on IE?

I am trying to trigger the onScroll event this way using prototype: Event.observe(document, 'scroll', function(){ alert('boo'); }); It works perfectly on firefox, but nothing happens on IE. Does anyone know why? and if there is another way to do so? Thanks ...