javascript

Element ID in HTML Document ~ Naming Question

Are there any issues (either technically, or otherwise) with putting a space character in an element ID? For example, something like this: <li id='something with spaces'>Test123</li> I understand that this is NOT desirable (I have never used spaces before), but I have hit a scneario where I need to do this if possible. What are the p...

a simple question on jquery closure

what does this mean? (function($){ })(jQuery); to make the question clearer, what does wrapping a function in parenthesis mean in JS (sorry, I'm a bit confused on the concept of closures). What about the $ parameter? and the "jQuery" in the end parenthesis? Can I do the same with mootools and combine them in 1 JS file? (function($){...

User Definable Attributes on HTML Elements?

What I need to do is be able to store some piece of data about an element. For example, lets say I have a list item <li>, and I want to store some data about it in the element, like "This is element 1 from XYZ". The only way I know how to do this (which I don't want to do if I can avoid) is this: <li id='item1'> Item 1 <!--This is...

asp.net pass javascript code from database

The Question: Is there a way that I can pass a JavaScript function into a page (from a database) to be run? Background info I have developed a metadata driven asp.net mvc web site (basically I change data in the db, and the pages get generated on the fly). Unfortunately I have one page that has some routing requirements (i.e. if you ...

Injecting JQuery Cross-Domain

Hello, Is it safe to inject JQuery's script using JsonP? The installation of my web application is - adding a script to a customer's website (like google analytics). I was thinking of using JQuery on the customer's website, as part of my own injected script. I was wondering, if there is some kind of risk? The application needs to supp...

Javascript Prototypes (the one like Closures not JQuery)

I just picked up a new book on ASP.NET and AJAX and in it there is a sample like this: Person = function(firstName) { this._firstName = firstName; } Person.prototype = { get_FirstName = function() {return this._firstName;} } I noticed immediately this is not what I am used to, and FireBug apparently agrees with me that its wo...

Upload a file into SharePoint using FORM POST

I would like to upload a file into share point using FORM POST. I am trying in this way <FORM NAME="oForm" id="oForm" ACTION="<site>/_layouts/Upload.aspx?List={A4793E2B-3081-4668-B6F1-0A013159F9B1}&RootFolder=/sites/servdeldocmgr/Test SOAP2" ENCTYPE="multipart/form-data" METHOD="POST"> <input type="file" name="file1" id="fil...

Can we use any type of javascript code as a external .js file or somtime it's necessary to place in <head>?

Can we use any type of javascript code as a external .js file or sometime it's necessary to place in <head>? ...

How to judge which javascript can be placed at bottom or which must be in <head>?

We can place JavaScript in 3 ways? as a external file in <head> in body <body> all methods are valid by W3C ? So How to judge where JavaScript should be placed at bottom or which must be in <head> or in <body>? I've seen JavaScript on many sites in <head> , as a external js, just before </body> and some time anywhere in <body>......

How would I show elements based on what is selected in a drop down using jQuery?

Here is my run-of-the-mill drop down: <select name=""> <option value="">--Select One--</option> <option value="textarea">Text Area</option> <option value="textbox">Text Box</option> <option value="checkbox">Check Box</option> <option value="dropdown">Drop Down</option> </select> What I want to do is show show/hide other elem...

Are there any JavaScript libraries for interacting with AOL's OSCAR protocol?

I know AOL provides a library for their Web AIM (or whatever its called) but I'm more interested in something I can use with something like v8cgi. ...

javascript - Failed to load source for: http://localhost/js/m.js

Why oh why oh why... I can't figure out why I keep getting this error. I think I might cry. /*** common functions */ function GE(id) { return document.getElementById(id); } function changePage(newLoc) { nextPage = newLoc.options[newLoc.selectedIndex].value if (nextPage != "") { document.location.href = nextPage } ...

Too many data points in set. Looking for ways to prune.

I am gathering data from a website. I estimate to get 10.000 datapoints (time - value) multipled by seven - over time. That is way to much. Both for storing and plotting it in a real time alike graph (through jQuery flot). I'm looking for a text dealing with this sort of problems. To be more precise: algorithms, statistical math for find...

Cannot load google map javascript dynamically

Hello, The follow tells me that GMap2 is not defined. But the code that uses GMap2 is in the callback. $(function() { $('#sample').click(function() { $.getScript("http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;sensor=true&amp;amp;key=API_KEY_HERE", function() { var map = new GMap2(d...

Style substring in a HTML <option> from a <select>

Styling of items in a option list is easy: use a CSS definition and apply it: <select> <option>Option 1</option> <option style="color: #F00; font-weight: bold; padding-left:2em;">Option 2</option> <option>Option 3</option> <option style="color: #00F;">Option 4</option> <option>Option 5</option> </select> But what is the ...

Preserving a reference to "this" in JavaScript prototype functions

I'm just getting into using prototypal JavaScript and I'm having trouble figuring out how to preserve a this reference to the main object from inside a prototype function when the scope changes. Let me illustrate what I mean (I'm using jQuery here): MyClass = function() { this.element = $('#element'); this.myValue = 'something'; ...

Dynamic onclick function assignment with dynamic parameters in JavaScript?

I have this code: document.getElementById('img'+i).onclick = function(){popup_show('popup',array_msg[i]+'|||'+date('Y-m-d',strtotime(lec_date))+'-==-'+str_view_forConflict, 'AddEditSchedule;;popup_drag2;;EditSched;;'+String(array_msg_id[3])+';;view', 'popup_drag', 'popup_exit', 'screen-center', 0, 0);}; ...but when I click on the imag...

What functions does Javascript use to modify html?

In a HTML/Javascript webpage, the javascript file takes the body of the html, renders the contents in the tag in Flash, and displays the flash content. The page is not flash, it is still Html, but the javascript must be modifying it to display it in Flash. What i want to know is what functions/methods does Javascript use to modify the ...

IP and Subnet to Start IP End IP

So I have an IP with a Subnet like: 8.8.8.0/24 How can I convert this to 8.8.8.0 and 8.8.8.255 (actually their ip2long resultants) In PHP and JavaScript ...

Resize browser to specified pixel

Hi, I want resize browser window to 1000x700 pixel by default on load of html page. Also whenever you resize window the minimum dimension 1000x700 should be maintained. I tried window.onresize = function(){ window.resizeTo(1000,700); }; but in IE8 its not working giving error "Access denied", however in FF its work fine. Please...