javascript

javascript escape string

I have the following string: 'You've just created' When I assign this string to a JavaScript variable, this is interpreted as 2 strings because there's a ' character. How can I escape it? ...

How to create a guided tutorial for a web-page using JavaScript?

Certain websites (notably Facebook games) have a step by step tutorial for new users, where JavaScript is used to create a pop-up which tells the user where to click next and what is happening. How does one create such a system? What sort of architecture is required? I suppose that a script is loaded if a flag is a tutorial flag is set...

extract url from string with Javascript

hi everyone, this sounds like something you could just google, but been looking for hours. basically have this string i am ajaxing from another site 'function onclick(event) { toFacebook("http://www.domain.com.au/deal/url-test?2049361208?226781981"); }' it comes out like that because im extracting the onclick. i just want to extract...

Good HTML/Javascript Poll Widgets

Facebook, twitter have some cool widgets (share, comments etc.) but I can not find similar poll widgets. What simple, customizable and free poll widgets can you advice? ...

Echo Javascript Alert Before Redirect, usleep(2000000)? - PHP CodeIgniter

Hello, I'm trying to have a javascript alert, after a database interaction and before a page redirect (back to the same page, but displaying the updated data). I thought having a pause before the redirect with usleep() might work, but it seems to ignore it. If I comment out the redirect it takes me to the controller page, where the ale...

trigger('change') selects the 1st option, which I don't want

I have a select that has several options. No empty option. Before calling the trigger none of the options are selected, after it runs the first option is preselected, and I want that the select to stay as it was, no option selected $("#selProduct").trigger('change'); How to fix this? I still want to trigger the change, to run the eve...

Extracting the javascript from an anchor's href using jQuery or JavaScript

Does anyone know an easy way to use jQuery (or other Javascript if necessary) to extract only the Javascript portion of an anchor tag's href attribute (like the one below), so it can be assigned to another event at runtime? <a id="FancyLink" href="javascript:DoSomething('Input1')">Do</a> I know how to get the anchor's whole attribute ...

what does this mean? javascript question

var a = window.a || {}; ...

My web page only prints onto 1 page (there is no break)

I'm having trouble printing a web page of information, which should span onto about 3 pages. Currently, only 1 page is printed, and the rest of the data is not visible anywhere? Is there some JS or HTML I can use to break the page, and allow the information to continue being printed on the next pages. ...

How do I read a GET variable from JavaScript/jQuery?

How do I get a particular GET variable in JavaScript or jQuery? I want to pass it on in ajax script in this sort of way: $.ajax({ url: 'foo/bar.php', data: { search: $(this).val(), page: something //$_GET['page'] only in js }, ... ...

Why this regex is not working for german words?

I am trying to break the following sentence in words and wrap them in span. <p class="german_p big">Das ist ein schönes Armband</p> I followed this: http://stackoverflow.com/questions/2444430/how-to-get-a-word-under-cursor-using-javascript $('p').each(function() { var $this = $(this); $this.html($this.text().r...

document.insertBefore throws error for unknown reason

I have this piece of code: <textarea id="test" style="width: 400px; height: 100px"></textarea> <script> var inserting = document.createElement("div"); document.insertBefore(inserting,document.getElementById("test")); </script> Which should insert DIV id=inserting before textarea id=test, but this error occurs Node was n...

problem in rails with "cycle" over classes in a CSS and onmouseover, onmouseout

i have this code in my index.html: <div id="users-list"> <tr class="<%= cycle('odd', 'even') %>" onmouseover="this.className='over';" onclick="location.href='<%= user_path(user) %>'" > <td><%= user.surname %></td> <td><%= user.name %></td> </tr> </div> as part of a table, and this associated css: #users-list .odd { backg...

Compress all file .js with Google Closure Compiler Application in one File !

Hi everyone, I would like to Compress all my file .js in a same directory in one file with Google Closure Compiler in a command line. For one file it's : java -jar compiler.jar --js test.js --js_output_file final.js But I didn't find in the doc how put my other file at the end of final.js without write over the last compress file ? I w...

javascript datastructure question

I have an array: myArray = []; To which I am adding objects: data = []; myArray.push( { elem1: ..., elem2: data.push(...); } ); So, elem2 in the object contains an array. How can I, given myArray add new elements to the array in elem2? I tried the following: myArray[idx].elem2.push("new data"); But got an error saying tha...

Accessing JSON values with a variable

I'm trying to access JSON data with jQuery and grab a specific set of values based on a variable. I've done this before using [] but for some reason I can't figure out what is going wrong this time. My JSON file (being read in by getJSON, and named jsonmaker.php) looks like this: {"0107001":{"label":"Canada","x":"0","y":"0.34"},"01070...

google maps v3 API mouseover with polygons. Not working

I'm trying to get mouseover to work polygons in google maps api v3. I've tried the answer provided in this post: http://stackoverflow.com/questions/1751710/google-maps-v3-api-mouseover-with-polygons This answer should be working, but it's not for me. Can anyone spot the stick in my spokes? Here is my code: <!DOCTYPE html> <html> <he...

save memorystream and continue

Hello, I want to save MemoruStream, and I use folowing: ... response.BinaryWrite(myStream.ToArray()); response.End(); User gets saving dialog and he can chose to save file or to cancel saving. But, problem is that can't continue to run code if user chooses to cancel download or, if he chooses to save file. I want to call another meth...

What does this "(function(){});", a function inside brackets, mean in javascript ?

Possible Duplicates: What does this mean? (function (x,y)){}){a,b); in JavaScript What do parentheses surrounding a JavaScript object/function/class declaration mean? Hi All I don't know what the following does: (function(){ // Do something here ... })(someWord) //Why is this here?; My questions are: What's the mea...

Gmail close control when you are writing an e-mail

How Gmail shows this alert "Exit this page? Your draft has Been modified. Your draft has Been modified. Click OK to continue or Cancel to stay on the current page." when you are writing a email and you try to close the browser tab? ...