javascript

AJAX FIle Upload: Filename doesn't appear in textfield of type file

Hello all, I am making use of Andrew Valums awesome AJAX file uploader. I am having a problem with it though, its a small issue. I want the file that was selected by the user and uploaded to be shown in the textfield. But it never seems to appear it just uploads. How can I do this or why is this happening? Thanks all ...

jQuery: select random elements

How Can I select the first 5 random elements <ul> <li>First</li> <li>Second</li> <li>Third</li> ... <li>N</li> </ul> I'm using this plugin: alert($("li:random").text()); but it takes all random elements. I only want the first 5. Or is there another way to do the same thing? Thanks ! ...

JavaScript: Alert when user exits site?

My boss wants our site to show an alert if a customer tries to exit the site with items in the cart. How can I show an alert when the user tries to exit our site? Also I don't want to show the alert if they are just navigating to another page on our site, but only if they are navigating completely away from our site. P.S. I am not usin...

Submit unmasked form value with jQuery/meioMask

I mask the input of fields like SSN to contain dashes when they are displayed but would like the value that is submitted to be only the numbers. For example, my SSN is formated as: <input type="text" name="ssn" alt="999-999-9999"/> And upon entering "1234567890" I get the nice formatted output. 123-456-7890 Now I would like only t...

Javascript: designMode for iframe doesn't work with FF when in jQuery dialog

Hi, here's the sample code (fully working - just copy to an empty html file and it will work): <html> <head> <title></title> <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/redmond/jquery-ui.css" type="text/css" media="screen" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/...

how to stop asp:UpdatePanel async call from calling pageload

Using: ASP.NET, C#, Javascript I have a page which calls a javascript function on pageload which binds several events to elements. The page also contains an update panel. When an asynchronous postback is made the pageload function is called again and the events are binded. This has some undesireable consequences on the page and i was wo...

Build a Google Suggest box and respond to keyboard events without jQuery

I need to build a Google Suggest style drop-down box, but unfortunately am unable to use jQuery or Prototype due to various licensing restrictions. Pretty much the only thing I can use is public-domain stuff that I can modify and am not required to attribute ownership of someone else to. In any case, I can handle the AJAX stuff fine, a...

Regex To Match &amp;entity; or &amp;#0-9; And Capture &amp;

I'm trying to do a replace on the following string prototype: "I&amp;lsquo;m singing &amp; dancing in the rain." The following regular expression matches the instance properly, but also captures the character following the instance of &amp. "(&amp;)[#?a-zA-Z0-9;]" captures the following string from the above prototype: "&amp;l". How can...

Text Gradient whith sIFR 3

Hi, I want to use sIFR 3 to add a simple linear gradient filter to a text, I can't find this in the ducumentation hope you guys can give me some help. I found an article that show's how to do this but requiers the modification of the flash file and that's not what I want to do. I looked in the sIFR documentaion and I didn't found a Gr...

scrape ASIN from amazon URL using javascript

Hi, Assuming I have an Amazon product URL like so http://www.amazon.com/Kindle-Wireless-Reading-Display-Generation/dp/B0015T963C/ref=amb_link_86123711_2?pf_rd_m=ATVPDKIKX0DER&amp;pf_rd_s=center-1&amp;pf_rd_r=0AY9N5GXRYHCADJP5P0V&amp;pf_rd_t=101&amp;pf_rd_p=500528151&amp;pf_rd_i=507846 How could I scrape just the ASIN using javascript...

target schema for validation to ie7 in asp.net 2.0

i am trying to use dojo in my latest project in asp.net 2.0 i keep get error message validation (internet explorer 6) attribute 'djconfig' is not a valid attribute of element 'script' how do i resolve this error ...

ASP.NET with VB. ListBox adding and removing items

Hiya i'm creating a web form and i want a user to be able to make certain selections and then add the selections to a text box or listbox. Basically i want them to be able to type someone name in a text box ... check some check boxes and for it up date either a text for or a list box with the result on button click... e.g. John Smith ...

How to execute Javascript from Python on Windows?

Hello, how can I execute Javascript from Python on Windows? I want to get python-spidermonkey functionality. Just like this: >>> class Foo: ... def hello(self): ... print "Hello, Javascript world!" >>> cx.bind_class(Foo, bind_constructor=True) >>> cx.eval_script("var f = new Foo(); f.hello();") Hello, Javascript world! I can't ...

Get CSS setting in JavaScript

Suppose I have a table in a web page: <table><th id='th1'></th></table> Then I define the CSS in the header: #th1 {width: 100%;} The question is, how to get the CSS width using JavaScript? I tried width, style.width, and jQuery("#th1").css("width"), but neither of them give me the result of '100%'. ...

Popping up windows from a SharePoint webpart

Hi there, I'm trying to pop a window up, from inside a procedure running in SharePoint. I need to pass a parameter to the URL, and have been trying to run the following, however, the popup never pops up. string sURL="http://myserver/mypage.aspx?param1=abc"; Response.Write("script LANGUAGE=\"Javascript\">\n"); Response.Write("window.ope...

Highlighting the "current" textbox on a web form

I have a data entry web app where the control that has focus is given a yellow background color (and when the user navigates away, it turns back to white). The script to do this came from I-don't-know-where, and it breaks in IE7 causing all sorts of problems, like drop downs not working (the script was designed to work on textboxes and ...

Contents of iframe disappears after inserting it using jQuery.append

Hi, Please consider this code: <html> <head> <title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.js"&gt;&lt;/script&gt; <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"&gt;&lt;/script&gt; </head> <body> <div id="dlgDiv" style...

Javascript closure / variable scope question - I know it works, but why?

Hi, I've been developing with JS for a while, and while I know that code below works, I don't really understand why it works. The way I see it, I've defined testString in testClosure function, and I'm expecting that variable to 'go away' when testClosure function is done, since it's local variable. However, when I call inner functio...

ASP.NET UpdatePanel Javascript Callback

I came across this issue recently and thought it was really helpful. My question was, how would you call a piece of javascript after an updatepanel loads via AJAX in ASP.NET? I needed to reinitialize a jQuery datepicker after the panel had loaded. ...

AJAX/Javascript Error Ruby on Rails...

Ok so here is where I am at. I have three different things here and I am very close to getting it to work. I have a form with a checkbox = value of 1 that collects a "vote" for a "post" and sends it to the database with the post_id. This works great. I have a partial template that rendors that particular posts votes back underneath t...