javascript

How do I build a gracefully-degrading HTML5 Range?

I'd like to use the <input type='range' /> from HTML5 for browsers that support it and degrade to a <select /> if not. I'm using Ruby-on-Rails, so failing all else, I could do something like this on the server-side. I would prefer, though, to have something more inline with the idea of progressive enhancement done via Javascript. Bonus ...

Can we use AJAXToolKit and Jquery in the same page

can we use AJAXToolKit and Jquery in the same page? Say i have ScriptManage in that same page and i have also included the ...

jquery Help with getting Id of table row

Hello, I am doing an AJAX request with Jquery and PHP what I am doing is looping through an array and producing a table, each loop a new is created and an id is given to it, when they click the read me link the ajax and some more content is returned, on clicking read more I want the associated table row to be removed from the table is th...

Keep values selected after form submission

<form method="get" action=""> <select name="name"> <option value="a">a</option> <option value="b">b</option> </select> <select name="location"> <option value="x">x</option> <option value="y">y</option> </select> <input type="submit" value="Submit" class="submit" /> </form> On submitting the form, ...

Javascript/Jquery: .css pixel-values

Hi! I just realised there is a difference between <foo>.css('marginTop') (which I thought is the standard jquery-notation) and <foo>.css('margin-top') (which I thought was non-standard). If has margin-top: 3em; (for example), the first notation gives me 3em, the second notation gives me 48px (which is 3em in Pixels). I like this...

Can using element.focus() just after an element's declaration in HTML be harmful?

I want to make a form in which I want to automatically give focus to a field. In the old days I learned to always wait doing any DOM manipulation till window.onload has fired, as the DOM might not be ready. Since JQuery the DOMContentReady event has grown famous, which fires (in compliant browsers) somewhat earlier than window.onload. T...

Send code from page to php script

Hi. I have a html page with javascript which change the content of page and I want to send the new content to php script? How can I make this? ...

How to hide or show a div based on its contents

Hi I'm trying to hide/show a div based on an AJAX response. I really don't know, is there way for that? If response is an error, show the error text and show the div (same div). If response is not an error, show the success text and hide a div (same div). It's like facebook function. I should do that with javascript function(s). EDI...

childNodes.length 0 in Chrome / Correct In IE & FF

I have a div with children that I need to crawl looking for specific links. The HTML looks like so: <div id="ctl00_LeftNav"> <h3> <a href="../App_Templates/#" rel="0">Menu 1</a></h3> <div> <p> <span> <div style="padding-left: 0px; font-weight: bold;"> <a href="javas...

how to create an ajax pop pulling a data from db ?

Hi, can someone tell me how to create a nice small tooltip like ajax pop-up ? the situation is like this, I am pulling the $row->title from the db, and then I presented it as a link like this <?php foreach($task->result() as $row): ?> <tr> <td><a href=#><?php echo $row->title; ?></a></td> </tr> <?php endforeach; ?> wh...

UserVoice widget close button event override

I want to be able to modify or add to the onclick of the a href tag for a UserVoice widget. This code is generated for me. <a title="Close Dialog" id="uservoice-dialog-close" onclick="UserVoice.Dialog.close(); return false;" href="#close"><span style="display: none;">Close Dialog</span></a> I want to call what is there but add my own...

Disable LinkButton when OnClick Event Fires

I have an asp:LinkButton as follows: <asp:LinkButton ID="LinkButtonNewServicesCategory" runat="server" OnClientClick="this.disabled=true;return false;" style="float:left;margin-right:5px;" CausesValidation="False">new services category</asp:LinkButton> The intent is that when the LinkButton is clicked, it disables itself an...

Grabbing asp.net controls in javascript

I have a page where it is getting overwhelmed with code like: var textBox = $get("<%=textState.ClientID%>"); This requires me to have my JavaScript inside the page instead of nicely tucked in a js file. Is there a better approach to this? document.getElementById doesn't work because then I end up with code like this: var textBox = d...

Inserting a Quicktime Player similar to apple.com

Looking at Apple Website they do an outstanding job with the quicktime movies they show off to their users. When I've included quicktime links before, the player that actually shows to users is quite bland, and across browsers really differs from what it looks like in safari, chrome, ie, firefox. Apple seems to handle all these conditi...

How to disable CKEditor context menu?

Does anybody know how to disable CKEditor's context (right click) menu? I would expect a configuration option, but I can't find one. I am using v3.1. Thanks. ...

ajax without a callback

Does any javascript framework has a function, which: makes AJAX request returns the response ( it does not take a callback function as an argument ) I basically want to do the AJAX request the same way I do SQL querys in C, python or whatever. ...

Rails: How do I use a javascript variable outside <script.../> but inside the view?

In a view I have a script (javascript) that declares a variable after some deep processing. How can I use that variable outside the script boundaries in the same view page? some_view.html.erb <script>var seq = Sortable.sequence('list');</script> # How to do this? Is it possible? <%= sortable_element "list", :update => "order", :c...

CSS, JS questions on (1) improving JS code through CSS and (2) removing blue dotted borders around hyperlinked images

div.img { margin:7px; border:3px solid gray; height:110px; width:110px; float:left; text-align:center; } div.img img { display:inline; margin:3px; border:1px solid white; } div.img a:hover img { border:3px solid yellow; } function handleMouseClick(imageName) { document...

How do I create a dialog in javascript?

Hello, The goal is to create a similar to the flag dialog at stackoverflow that shows on clicking the 'flag' button located under a question,but since I'm new to web development I don't understand certain things. This is what I have: This is the markup for the button: <a id="flag-post-2239985" title="flag this post for serious probl...

jQuery alert plugin that produces alerts like Twitter/StackOverflow?

A while ago I came across a jQuery plugin that produced the alert/message boxes like those seen on Twitter (when saving settings) and StackOverflow. Can somebody point me to them online? I'm having trouble getting relevant search results... Thanks ...