javascript

formElement is null with Mvc Client Validation

I'm getting a "formElement is null" when trying to use MVC Client Validation. Does anyone have any thoughts as to what could be the issue? Sys.Mvc.NumberValidator.create=function(rule){return Function.createDelegate(new Sys.Mvc.NumberValidator(),new Sys.Mvc.NumberValidator().validate);} Here is my model: public class EmailViewModel ...

Does a JavaScript bookmarklet need to be a valid URL?

I've searched around but I can't find any information about this; maybe I'm not using the best search terms. Does a JavaScript bookmarklet - i.e., a link that uses the "javascript:" pseudo-protocol that can be dragged to a browser's address bar and opened on any page - need to be a valid URL? I've heard that it does, but I'd like to fin...

Dynamically create form elements with php

This short program is suppose find the column names of a table X, and create a form with at least one text field and one select element that contains all the names of the columns of the table. With that information, the user can perform a search on this table and further specify on which column he would like to do the search. I would lik...

Javascript: addEventListener with onkeydown doesn't seem to work

If you replace "onkeydown" with "click", it reacts, at least. <input id="yourinput" type="text" /> <script type="text/javascript"> document.getElementById("yourinput").addEventListener("onkeydown", keyDownTextField, false); function keyDownTextField() { alert("functional"); if(keycode==13) { alert("You hit the enter key.")...

Embedding image in QWebView with JavaScript

I am writing a small application with Qt 4.6 (64-bit Arch Linux, though that shouldn't matter) which lets the user edit a document using a QWebView with contentEditable turned on. However, for some reason embedding an image does not work. Here is a code snippet: void LeafEditView::onInsertImage() { // bring up a dialog, ask for an...

JS expand empty range in IE

I have a caret in the textarea (no selection). I need to make selection out of it. For example: "This is a te|xt" var caret = document.selection.createRange (); // got empty range between "e" and "x" caret.moveEnd('character'); // Move endpoint one character right, now it must be "x" alert (caret.text); // empty !!! What is wrong? ...

jcarousel, I need :active state on external controls

I am running a Jcarousel and I want to add a.active to the current pagination option. I have seen other posts around about this same thing. /** * We use the initCallback callback * to assign functionality to the controls */ function mycarousel_initCallback(carousel) { jQuery('.jcarousel-control a').bind('cli...

Global event if a jQuery selection returns no elements?

Is there any way to globally monitor or listen to if a selection is made in jQuery and it returns no elements? E.g.: You have a page with: <div id=”some-id”></div> And in a JavaScript someone tries to get the element but mistypes the id: $(“#someid”) Is there any way to globally handle when a jQuery selection returns no elements? ...

dropdownlist is asp.net

I want to display countries and the corresponding states in dropdownlist. Which method is efficient for storing the data in database and displaying it using updatepanel or filling dropdown at client side using javascript. I am confused which approach should I follow or is there any other way? ...

JS caret to selection by pressing button in IE

I have a caret in the textarea (no selection). I need to make selection out of it by pressing a button. For example: "This is a te|xt" var range = document.selection.createRange (); range.moveEnd('character'); range.select(); alert (range.htmlText); But when I press button, the text on the button is being selected, not in the text fie...

Dojo Parseonload:false Then not loading Dojo modules

Hello, I have some Dijit Tabs, and in those tabs I have some Dojo Text boxes and Fields. Some of my Dojo Tabs load when the page is loaded, and some load only when clicked on. My issue is that I cant get the Tabs that load only when clicked, to work with the Dojo modules. Its hard to explain, so I made a simple example to help. I h...

When does a load event of a browser occur?

Wondering when does a load event occur in a browser? Is it when it receives the header information? ...

[VS2008] What is the best javascript editor add-in you ever used

Hi folks: At recent times, I frequently edited .js files through VS, but it awkward. Could you suggest some excellent add-ins to faciliate the work? Thanks. ...

Javascript: window.location.href doesn't redirect when calling function within a function

window.location.href redirects the browser to stackoverflow.com when the button is clicked, but does not when hitting "Enter" in the input textfield, despite both event listeners using the same function visitStack. If this helps, changing the form tags to div tags somehow makes it work, but it's not semantic, of course. Changing "keydo...

jquery desktop blocking input and textarea

I'm trying to modify this: jquery desktop by adding a input field inside one of the windows. However, I can't type anything into the input. I opened firebug and the classes are flashing when I click the text input so I'm guessing that's what's blocking it. But I don't know how to fix this. Any help is appreciated. ...

How to execute a javascript every time i open a specific website in Firefox?

Actually, the problem is every time i access zedge.net i have to select my phone from the list. Now, what i can do is, once i click on 'no phone selected' i can write: javascript:zlibQuicklinkPhone(2, 1476, 0); in address bar and pressing Return key will select my phone. But i want this to be done automatically. How can i do this? Not...

jQuery make loaded file part of DOM

I've loaded file in div $("#div").load("file.txt"); That file has html images . I want to access them by $('#div>img') (or other selectors), but nothing happens. If they were in page initially, there are no problems. How can you access loaded content by jQuery as part of the usual page? ...

Pure Javascript image handling library (in binary form, not through DOM)

Since File API will enable access to the content of local files it is now possible to do image resize before upload (a fairly common task) without any additional technology like Flash or Silverlight. Except that I can't find any Javascript library that would be able to handle images in binary form. Is there any? Maybe there is some in Fl...

jQuery Method to select the contents of a whole page

How can I select the contents of the whole page using jQuery for later to be copied to clipboard and hence another WYSIWYG. The case is: $("#SelectAll").click(function(){ //CODE TO SELECT ALL THE CONTENTS OF THE CURRENT PAGE /* PS: $("body").focus(); $("body").select(); //doesn't work */ }); Any help is appreciated. Thanks FOUND T...

how do I assign page referrer to a php variable

I am using javascript to get the referring page (document.referrer) which works fine and I can add this value to a div no problem. How do I assign this value to a PHP variable in order to do some other things with it? Ideally, something like: $myphpvariable = document.referrer; ...