javascript

Auto login in greasemonkey

I'm not being able to make an auto login on this source in greasemonkey... Can anyone help me? <div id="login-main"> <div id="login-container"> <div id="login-left"> <div id="welcome">Welcome</div> <form id="login-form" action="auth/login" method="post"> ...

Selecting single user clicked img in jQuery

I have an accordion menu that I am trying to get images to switch from plus to minus when the accordion is activated. Currently I can only get all images to change to a minus when anything is clicked. There are already bg images on the links and I really dont want to go that route.. $(function() { $('#menu ul').hide(); $('#menu > li...

Is it possible to access the content generated by a css :before rule?

I'm experimenting with using html5 and css counters to number the figures in a document. The figure numbering css is working, but I need to be able to generate cross reference that include the figure numbers. Is there any way to access those values via javascript? The counter code I am using is: body { counter-reset: section; } section...

Have jQuery submit a form to get a file download?

I have a form that posts to a url which triggers file download. The server is ASP.NET MVC and I write out a CSV file. What I want to do is have a jQuery/javascript submit the form instead of a form submit button. For example, I created a link and attached a handler using jQuery to submit the form: $(function() { $("#mylink").clic...

In Rails, how do you functional test a Javascript response format?

If your controller action looks like this: respond_to do |format| format.html { raise 'Unsupported' } format.js # index.js.erb end and your functional test looks like this: test "javascript response..." do get :index end it will execute the HTML branch of the respond_to block. If you try this: test "javascript response..." ...

JavaScript == vs ===

Possible Duplicate: Javascript === vs == : Does it matter which equal operator I use? Is it bad to use the == oeprator in JavScript? What is the difference between If(something == "somethingElse") and If(something === "somethingElse") ...

How do I remove ajaxpro *.ashx handlers from individual pages?

I working on a ASP.NET web project where Ajaxpro.2 is referenced, and it seems automatically to add a bunch of ashx handlers to the page output - ie, core.ashx, prototype.ashx. The problem is, I only need these to be present on a few pages, not the entire site. In trying to optimize the page download size (particularly for static public...

how to find out how many items are selected in select box

I have a select box which has more than 200 items. Below the select box is the submit button which submits the form using javascript. I want to restrict the user to only select 100 items from the select box. If they select box and try to submit the form then it will say Select 100 Only How can I do this in Javascript? ...

jQuery cookies setting select drop down value after page refresh

In all honesty my brain is rather fried after getting this far today. I am trying to save the state of multiple select drop downs on page using this plugin: http://plugins.jquery.com/project/cookies I am using this jQuery to set cookies for the different title drop downs based on their ID: $(document).ready(function() { // hide 'Oth...

quick question about onclick

Can i do like this: <a href="#" id="thelink" onclick="window.parent.OpenVote("<? echo $_GET['id']; ?>", '<? echo $rowData['username']; ?>');"> It doesnt seem to work.. ...

How can I iterate through files in Javascript

Hi, Is it possible to iterate through a collection of files in Javascript? I am writing a jQuery plugin that takes either an array of images or, I was hoping, a directory containing a list of images. E.g. either: ['image1.jpg','image2.jpg','image3.jpg'] or 'http://somedomain.com/images/' I would then like to be able to iterate thr...

document.hasFocus() for chrome

Does anyone know what to use instead of hasFocus() for Chrome? I want to know when my Chrome tab has focus or not, so I can blink an alert message in the title. Cheers ...

What's the best library to do a URL hash/history in JQuery?

I've been looking around JQuery libraries for the URL hash, but found none that were good. There is the "history plugin", but we all know it's buggy and isn't flexible. I am loading my pages inside a div. I'll need a way to do back/forward along with the url hashing. mydomain.com/#home mydomain.com/#aboutus mydomain.com/#register Wha...

The Checkbox opens link onClick when form is submitted, but how do I post the form at the same time?

I am trying to build a downloads section where the visitor completes a form and then selects check boxes to open download dialogs. I would like the form to submit and the dialogs to open, when the button is clicked. I am not very good at writing scripts, although I can read them. Currently I can only get one or the other to work! The ...

window.open specify content size not window size?

When you do a window.open() you can specify the size of the new window. well depending on a lot of things (like browser, toolbars, etc.) the viewport can vary in size. For example if I have an image that is 500x400 in size, and I want to open a new window to show exactly that image with no access white space, and no need for scrolling. ...

while() and onclick..

Hi. I have this: while( $rowData = @mysql_fetch_assoc($selectRows2) ) { ?> <div id="stemmeto"><a href="#" id="thelink" onclick="window.parent.OpenVote(<? echo $_GET['id']; ?>, '<? echo $rowData['username']; ?>');"> <?php echo $rowData['username']; ?> </a></div> <div id="stemme"> <a href="#" id="thelink" onclick="window.parent.O...

JSONP request to stackoverflow with mootools not working

I'm trying to build a custom stackoverflow badge using JSONP and mootools. Here is the code: new Request.JSONP('http://stackoverflow.com/users/flair/166325.json', { onComplete: function(data) { console.log(data); } }).request(); However, I always get back this message: RequestJSONPrequest_maprequest_0 is not defined I'm won...

Action call and javascript call in MVC web application

How do you call a server side code and javascript in MVC? We are having a close button on every page. on click of close button there should be a call to controller action and the browser should close. Also if the user clicks the browser close the same controller action should be called before closing. Have anyone done similar stuff befor...

Is it possible to paste an Image into Silverlight/Flash/JavaScript?

Is it possible to allow users to paste image data into a Website? That is, they have an image in the clipboard and can paste it into an HTML Site? (I would then somehow grab the bytes and store them - persistence isn't the problem here) It needs to be Cross-Browser IE8, FF3.5 and Chrome 4, but I can use browser plugins like Silverlight,...

Javascript dialog return

Hi, I've got a javascript function that draws a dialog. I'd like to have it return the value the user specifies. The problem is, the dialog is closed when a user clicks on of two buttons, which have onClick events assigned to them. The only way I know to grab these events is by assigning functions to them, which means that a return ca...