javascript

is there Any Dropdown <select> contains checkboxes ?

Hello! i need a dropdown menu "< select >" which contains multiple checkboxes. so people can drop down and select many options ( all the checkboxes should be inside the dropdown ) someones call the dropdown a combobox ( so just to make anyone understands ) i want this with javascript/css & not java applet or flash. Thank you! ...

Check if user closed the page in PHP?

I made a chat using PHP and JavaScript chat and there is a disconnect button which removes user from the chat removing him from user list first. But if the user closes browser then he will remain in the user list. How do I check if he left? This must be done without putting any handles on page closing in JS because if user kills the bro...

How to print directly to label printer from Internet Explorer without prompt

I have a mysql database containing upc numbers that I would like to print to labels with a zebra printer (LP2824). I would like to somehow be able to send those numbers directly to my label printer, which is not the default printer without the user being prompted. As far as I can tell, IE is the only option as some type of activeX contr...

Add New Gist using the Github API

I'm making a small app in Adobe Air which I need to interact with the Github Gist API. However I'm kind of stuck. If you're not familiar with Adobe Air you can still help, the XMLHttpRequest javascript object can do cross domain requests, as there is no domain as such. So theres nothing Adobe Air specific here. Where I'm stuck is I th...

jquery POST method callback function query

$("#submit_js").click(function() { var commentmsg = $('#comment').val(); $.post( "user_submit.php", {comment: $("#comment").val(), aid: imgnum, uid:$("#uid").val()}, function(data){ /*alert(data);*/ //$('#greetings').html('Your choice was submit...

Kill Event when hover off in Jquery

I've seen this somewhere before but I can't seem to find the little snippet. If I have a div that sets opacity (or animates up) on hover, but I hover off that div before its done animating, I want it to toggle back. Otherwise I hover over it a few times and I have 10+ seconds of animation/flashing to wait for. Here is my code: $("a.pr...

Form framework for dynaimcally adding, altering fields

I have several forms on my website in which fields are dynamically created or altered based on what is altered in previous fields? Is there a good framework for doing this easily? ...

Can I get a little help on this php/javascript voting code?

Hi folks, This is a continuation of this question: http://stackoverflow.com/questions/1987811/move-div-based-on-user-voting I first posted the question as an unregistered user, and then later registered, so I couldn't edit or add to my original question... Justin Johnson really helped me out with the code, but I'm still having a proble...

jQuery: Replace multiple regex matches with string?

I am trying to use this block of code to replace ALL "123"'s in a long string with a different number. var new_id = new Date().getTime(); $('#food').after( "<div id='123' name='123'> etc etc".replace('123', new_id) ); But it's only replacing the first 123 with the new_id. Is there a way to replace all of them? ...

Drag and drop ordering of formset with extra entries

I have been looking for a way to allow the user to easily change the order of entries in a formset. I found a StackOverflow question that addresses this subject, with the accepted answer referencing a Django Snippet that uses a JQuery tool to allow drag 'n drop of the entries. This is nifty and cool, but I have a problem with 'extra' e...

How do I ensure that the text encoded in a form is utf8

I have an html box with which users may enter text. I would like to ensure all text entered in the box is either encoded in UTF-8 or converted to UTF-8 when a user finishes typing. Furthermore, I don't quite understand how various UTF encoding are chosen when being entered into a text box. Generally I'm curious about the following: H...

Should I use DOM-ready functions if my scripts are at the end of the body?

I know that, in jQuery, we are told to use $(document).ready() in order to ensure that the DOM elements are ready for interaction. I know that this definitely applies if the script tags are in the <head>. If they are at the end of the <body>, after all of the DOM elements, should I still use a DOM-ready function? Are there browsers in wh...

TinyMCE and blockquotes

Hi, I have a TinyMCE field initialized as follows: ... extended_valid_elements: "ul[type],li,a[name|href|target|title],img[class|src|border|alt|title|hspace|vspace|width|height|align|name|style],hr[class|width|size|noshade],span[class|align|style],iframe[src|class|width|height|name|align],#p/div,strike", force_br_newline...

IE7 glitch with appendChild() for an input box

I am using the following JavaScript to add a number of inputs based on a number in a drop down menu. It works fine in firefox and chrome, but in IE7 the inputs all float left on a new line. function add(number) { var foo = document.getElementById("listInputs2"); var count = 1; foo.innerHTML = ""; while ( count <= (number) ) { //Creat...

How do I trigger the popup dialog box automatically from iWebkit?

Hi there. I'm creating a little iphone webapp for my school using the iWebkit (fancy css/javascript for making the interface for iphone / ipod touch web sites / webapps. There is a feature called Popup which simulates a popup that you get in settings on your iPhone when you reset all settings (i.e. confirmation popup). How can I make ...

javascript: can't set oncontextmenu property to pre-defined function

I'm trying to write a function that reads the oncontextmenu event for a div item. (I need it to find out whether the ctrl key was being pressed, e.g. by using e.ctrlKey.) This works: <div id="item_2" class="lineitem" align=center oncontextmenu="alert('foo');">test</div> But this does not: <script language="JavaScript"> function asd...

image included javascript not appear in the webView

hello ,I used webView to show javaScript,one image was included in the javaScrip,but the webView not run the image on the contrary appear a "?"image. Idonot why? my code: demo.html <html> <script language="javascript"> /* This function is invoked by the activity */ function wave() { document....

jquery selector help

i have a event i trigger on every link in my site. but then i want it to NOT trigger on links i've got class='nofocus' on. for example <a>link</a> <a class='nofocus'>register</a> $('a').live('click', function() { $('#searchbox').focus(); } how do i rewrite the $('a) so the second link wont trigger the event? ...

press Ctrl+Shift+Del outof firefox extension

So, i need to press Ctrl+Shift+Del in a program way. I want my extension to press Ctrl+Shift+Del and then press 'Enter' (to clean all history,cookies,cache and so on). i do next: var e=document.createEvent('KeyboardEvent'); e.initKeyEvent( 'keypress', true, true, window, true, false, true, false, 46, 0); document.dispatchEvent(e); Acc...

How to do window.open with no scrollbars in Google Chrome

The following code opens the new window without scrollbars in Firefox, IE and Opera. var options = { height: 300, // sets the height in pixels of the window. width: 300, // sets the width in pixels of the window. toolbar: 0, // determines whether a toolbar (includes the forward and back buttons) is displayed...