javascript

How to render a partial from javascript

I have a select that gets populated depending on the selection in a different select To do this, I did what is recommended in Railscast #88 on 'Dynamic Select Menus'. But now I need to render a partial, passing in the value selected in each of those selects. I can't figure out how to simply trigger a method call from the :onchange event...

Are you sure you want to navigate?

What is the JavaScript code/event(s) that is used by sites like stackoverflow and Gmail to test for the user exiting the page once they have begun editing and try to navigate away? "Are you sure you want to navigate away from this page?" ...

JavaScript Calculate Pricing form not working on PC. Works on Mac. Can someone find the error(s)??

Can anyone help me spot the problem on this PLEASE? I'm eternally grateful for the help this site has been already and appreciate any advice or thoughts. Thank you. The actual page can be seen here: http://www.procollage.com/pricing/photo-collage-pricing.html <script LANGUAGE="JavaScript"> function calculate(PricingForm) { height ...

Clone a div and change the ID's of it and all it's children to be unique

Using JQuery it possible to clone a Div like this and change add a new identifier to it's ID and all it's children ID's? For instance I'd like to be able to clone this: <div id="current_users"> <table id="user_list"> <tr id="user-0"> <td id="first_name-0">Jane</td> <td id="last_name-0">Doe</td> </tr> <tr id="user-1"> <td id="first_name...

how to make constant animation using jquery

hello i want to use .animate function but i have some problems i want to change the 'left' value but i don't know the width of the item that i will move so if i sent to animate timer to 1000 and the width of my item is 100px that will be different if the width of my item is 500px and for the animate when it comes near the end of it's ta...

Java applet or JavaScript for making an online form?

I don't know what I'm talking about. Please tell me what I need to know. ^_^" I would like to create an online test that sends the results to a certain email address, but I'm not sure how to begin. I think it's possible to make textboxes and stuff with both Java and applets, or JavaScript, right? Which should I try working on? I also wa...

What's wrong with my Scheme compiler?

I'm wondering why nested function calls don't work. I'm implementing Dybvig's Heap-based model from his paper http://www.cs.indiana.edu/~dyb/pubs/3imp.pdf Chapter 3. I'm doing it in JavaScript. Source is here: http://github.com/z5h/zb-lisp Pretty much everything is in parser.js right now. To run, load test.html in Firefox with Fireb...

Prototype.js: reset setStyle

Is there's any way how to reset styles back to what's in my CSS? Example: #foo {width: 50px; height: 50px; position: absolute; top: 150px; left: 250px;} function moveFoo(newpostop, newposleft){ $('foo').setStyle({top: newpostop+'px', left: newposleft+'px'}); } Now when I'm done with it, I'd like to move foo back when it was. I kn...

JavaScript Calling a Java Function Doesn't Work in Safari

Hi, I have problem with calling a java function from javascript. Although it works for other browsers like IE, Firefox and chrome, it doesn't in safari. Here is my code. <HTML> <HEAD> <TITLE>Simple Applet Example</TITLE> <SCRIPT> function callSpin() { document.getElementById("myslotmachine").spin(); } </SCRIPT> </HEAD> <BODY> ...

In Javascript (not JQuery), how do I make the window close after 2 seconds?

How do I create a function that will close the window after 2 seconds? <a href="" onclick="close_it(); return false;"> Click to close the window after 2 seconds </a> ...

jQuery in CodeIgniter, inside the view or in external js file?

I'm developing web application using CodeIgniter. All this time, I put the custom js code to do fancy stuffs inside the view file. By doing this, I can use site_url() and base_url() function provided by CodeIgniter. Today I want to separate all custom js code from view file into an external js file. Then it hit me, I cannot use site_url...

Customized horizontal scrolling content slider having Image Title & Description

I am working on a project in asp.net c#. I need to implement horizontal scrolling content slider having image title & description in the home page. Please suggest a good plugin/example that can customized to solve my problem. Screen snapshot of my requirement ...

How do I detect "the mode of redirection" using javascript?

Hello, During a browsing session, redirection usually occurs when, user clicks on an anchor element, user presses the reload button on browser, user clicks on any element and execute a javascript redirection, using window.location properties, programmatic (by javascript) redirection using window.location properties, (Th...

Auto-suggest Technologies and Options

I would like to integrate auto-suggest on my website. Which option should I pursue? Are there any advantages with going the jQuery route vs the Javascript route? What about disadvantages? What about having my local javascript request information from server-side JSP? I have about 10,000 keywords in my database that I'll be using. I wou...

Accessing DOM elements without id

i have a page around 500 div as below. <div onclick='test()' class='test> <ul class='innermenu'> <li>1</li> ..... </ul> </div> when the test function is called it need to hide the menu (innermenu) who calls that function. my problems are 1. uniquely identify the div without using id 2. How to...

Javascript running in facebox window

I'm modifying a website to have a pop up box appear when a user rates something prompting the user to login. Unfortunately the login process is something that I don't control and it uses a whole heap of javascript and redirects to do it and it seems that the javascript is failing. Can javascript run in the modal box or is there a way ar...

How to add Page Break dyanamically to Print page?

There is one long in the content on the print page, but while we print the some content of the text cut down. please let me know , if there is any dynamic way to add page-break css. the content could be any thing. ...

blackberry.location.latitude: i am always getting 0 why?/

<html> <body> <script language="Javascript"> if(blackberry.location.GPSSupported) { blackberry.location.setAidMode(1); blackberry.location.refreshLocation(); blackberry.location.onLocationUpdate(window.alert("Your new position is " + blackberry.location.latitude + " degrees latitude and " + blackberry.location.longitude + " degrees lo...

How to get the stack trace from errors in a FireFox extension?

Is there a convenient way to do this for my extension? I know I can use FireBug to get traces for exceptions which happen in content, but I don't think it works for chrome (does it?). I couldn't get ChromeBug to work when I last tried it. ...

How to encode URL in JavaScript and PHP?

I want to send a URL in a POST request in a variable called surl. How should I encode it in JavaScript and decode it in PHP? For example, the value of surl could be http://www.google.co.in/search?q=javascript+urlencode+w3schools. EDIT Sorry, I forgot to mention, it's not form submission but a ajax request. ...