javascript

Prevent Enter from selecting a single item in a list box

I have a multi select list box. I want to be able to select a number of items and act on the selection by pressing the Enter key. The problem I'm having is that when I press Enter the current item at the cursor becomes the only item selected. The others are deselected so my function only acts on a single item. What can I do to prevent th...

How to take convert a webpage to a image in javascript / Google web tool kit

Hi , I have a requirement to convert a webpage into a image. When a user clicks a button the new window need to display the webpage as a image. IS it possible to do in Javascript or Google web tool kit? ...

Possible to generate a file in javascript and prompt the user to download ?

Is it possible to generate a file in javascript and then prompt the user to download ? What we would really like to do is the following : we want to make a small html form where an user can edit values in a table, and we would like to be able to generate a csv file from the form and prompt the user to save it on his hard drive. Is it p...

Escape char problem while generating JavaScript page through Java code?

I am generating JavaScript pages through Java code like: FileOutputStream fs=new FileOutputStream("C:\\Documents and Settings\\prajakta\\Desktop\\searcheng.html"); OutputStreamWriter out=new OutputStreamWriter(fs); out.write("<script language='JavaScript' type='text/javascript'>"); out.write("var str=new String('C:\\Documents and Setti...

Pressing enter inside a textbox does not fire onclick event of submit button in firefox

I have this html page which is very simple, it contains a text box and a submit button, what I want is when typing something in the text box and pressing enter the function in the onclick event of the button gets called. It's working in IE and Google Chrome but not working in FireFox, is this a normal behavior of FireFox or there's somet...

[HTML/JavaScript]: getElementByID not getting value.

I am not able to figure out why it is not tracing value for CompanyType. If I remove the CompanyType block from verification, it works well. It even successfully verifies CompanyName, but it fails at CompanyType. Below is the code: <script type="text/javascript> //Check Company Name if (document.getElementById("CompanyName").value == ...

<a> tag problem while generating javascript through java code

How should I write a statement in Java to produce JavaScript in a page out.write("document.write('< a href='str'> '+str.slice(beg+1,end)+' </a>');"); so that it will create statement in JavaScript document.write("< a href=' "+str+" '> "+str.slice(beg+1,end)+" </a>"); //< a and the link will go to page whose address is stored in st...

Can I accept an image that is dragging in HTML?

In many browsers today you can click and drag images. Can I leverage this in any way? Could I receive an event when an image is dragged and dropped on top of another image in the same browser window? ...

jquery get selected text from dropdownlist

hello, How can I get asp dropdownlist selected text in Jquery, not selected value/ ...

fckeditor fileupload freeze, with autosave.

i work with asp.net and use the fckeditor. i got autosave with ajax updatepanel on my page and when i use the fckeditor fileupload it freeze, i cant do nuthing it stays open and i cant close it. i dont know why? i was thinking maby do a javascript that could detect if it was open then not run the autosave at that moment, you think that...

JavaScript: Remove current mouse highlight from the page?

Let's say I highlight some text on the page using my mouse. How can I remove all highlighted text using JavaScript? Thank you. ...

Javascript : Get month name from Date object

How can i generate Month name(ex: OCT / OCTOBER ) from this date object in java script ? var objDate = new Date("10/11/2009"); ...

JavaScript: Why the anonymous function wrapper?

It's very common nowadays for Javascript libraries / functions / code snippets to be encapsulated with an anonymous function, e.g. (function () { // code to be executed goes here })(); As far as I can tell, that should be completely superfluous: that anonymous function just executes the code within. However, there's obviously a re...

Is there any way to find an element in a documentFragment?

var oFra = document.createDocumentFragment(); // oFra.[add elements]; document.createElement("div").id="myId"; oFra.getElementById("myId"); //not in FF How can I get "myId" before attaching fragment to document? ...

How to dynamically retrieve the page URL within Flash using swfobject / JavaScript

Hi, I have created my own video player using Flash and AS3. Within the flash movie, i have a link which allows the user to copy the object embed code and page url on their own site, similiar to youtube. The player all works fine and retrieves the right flv's depending on what page you are own. I also have the object embed code working f...

Validate List of Sequential Dates with jQuery Validate Plugin

I am using the jQuery Validate plugin to perform validation on my form. I have a list of dates which is dynamically generated. It can include from o to x amount of dates. I need to validate that this list of dates is in sequence, and that any date toward the end of the list is not prior to a date that appears earlier in the list. I have...

Using javascript to show a grey-scale version of an image on mouse-over

I need a way to display a grayscale version of an image on mouse-over. I've seen this implemented using the Canvas functionality of the browser but don't want to use that method as it will be a while before canvas is implemented on all browsers. Has anyone done such a thing? ...

Capture mouse events for HTML option element on IE

For Internet Explorer only it seems that the target (srcElement) of clicks,mousedowns,mouseups,mouseovers,etc on <select /> elements will not be tied to the <option /> element. Given the following HTML: <select id="madness"> <option value="1">One</option> <option value="2">Two</option> <option value="2">Three</option> </sele...

Taking a hashed URL and sending it to a new URL

For example, I'd like to have my registration, about and contact pages resolve to different content, but via hash tags: three links one each to the registration, contact and about page - www.site.com/index.php#about www.site.com/index.php#registration www.site.com/index.php#contact Is there a way using Javascript or PHP to resolve t...

How to insert javascript using innerHTML (ie6 is giving me a unknown runtime error)

var head =document.getElementsByTagName("head")[0]; newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.innerHTML = '$(window).load(function(){ someFooo(); }); '; head.appendChild(newScript); This is causing an Unknown Runtime Error in IE6. Any other way...