There seem to be many different ways of doing OO in JavaScript.
I like:
function ClassA(){};
ClassA.prototype={
someFunc:function(a,b,c){},
otherFunc:function(){}
}
var c=new ClassA();
and have never used features beyond what this provides (despite being a proficient OOer). I suspect this is old fashioned, because every so of...
jQuery(document).width() doesn't include the total width (viewable + outside of viewable when there's a horizontal bar). It equals jQuery(window).width(). I thought jQuery(window).width() is the viewable area width and jQuery(document).width() is the total width.
How do I get the total width or how do I get the width of the area outside...
Here’s what I'm working with.
As you can see, I’ve got a lot of block elements, that I want to get into five columns.
However, since they’re of differing height, they don’t respond well to being floated. (Hence the huge hole in the middle of the page.)
I know I’ve seen a JS workaround, that calculated the heights and put the elements...
Isn't 1.8.1 the latest version of Javascript?
Why is https://developer.mozilla.org/en/JavaScript just giving you api doc for version 1.5?
...
I am a newbie to Jquery as will be evident.
I have 2 scripts in an external file named scrip.js and it is included with a simple
<script src="/media/javascripts/scrips.js"></script>
the two scripts in scrips.js are
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.va...
This is my code:
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
google.maps.event.addListener(map,'p...
I have got a database with latitude and longitude values in it. I can show only one marker at a time. I would like to show multiple markers at the same time. How can I do it?
...
this is my code:
google.maps.event.addListener(map,'bounds_changed', function () {
var left_bottom=map.getProjection().fromLatLngToPoint(map.getBounds().getSouthWest())
console.log(left_bottom)
});
i think the result may be this :
(0,some number),
but the result is :
(232.31212222222223, 155.07739681...
There exist some concept like variables variable to print variable names or call functions dynamically:
http://php.net/manual/en/language.variables.variable.php
Thanks in advance.
...
I'm showing a Google Map based on a street address supplied from an outside source.
My JavaScript is very simple, and I build the link like so
var googleMap = 'http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=' + address + '&ie=UTF8';
This is quick and easy, and works. But some of the in...
I have a structure of divs inside divs, something like this:
<div class='parent'>
<div class='a first'>something here</div>
<div class='a'>something here</div>
<div class='a last'>something here</div>
<div>something here</div>
<div>something here</div>
<div class='a first'>something here</div>
<div class='a'>...
Are there any tests that compare Javascript's performance with Java's?
UPDATE: Since everyone is asking why the hell this question, here is some context :)
As you all know - I hope - Javascript nowadays doesn't only reside in the web client but also in the web server with node.js.
It could also be run in mobile phones and dekstops wit...
How can I append style element to DOM without eliminating existing style on the item (eg color, text-align, etc).
The event calls the function, but the problem is 'Style' gets completely replaced with the single item instead.
I have simple code triggered on event:
function changeback(onoff)
{
if(onoff){
docum...
How to create a checkbox for the user without the user needing to submit it?
[] apple
[] grapes
[] oranges
[] mangoes
as soon as the user selects apples,grapes, oranges the SAME page must reload multiple times and say
"apples","grapes","oranges" etc
..................
Edit
Actually, I need to pass the variables with values as apple...
hey guys
Post Sniffing Rules
Although browser sniffing used to be quite popular, it's now gone out of fashion (for good reasons) and has been deprecated (if not dropped) by popular libraries such as jquery.
The better way is to do feature detection.
Exception To The New Rule
However, there are times when you might be targeting (for ...
Hi, I am using the following code to preload images in an image gallery:
$(window).bind('load', function(){
var imageNumber = $(".image").attr("alt");
var imageUp = parseInt(imageNumber) + 1
var imageUp2 = parseInt(imageNumber) + 2
var imageDown = parseInt(imageNumber) - 1
var preload = [
'image' + imageUp + '.jpg',
'image...
Working on a project that has a website and a Facebook page. They both reference the same SWF file and JS code that the SWF file uses to interact with the website/Facebook.
The custom Javascript action, which invokes the FB.ui() method for sharing, works so much in that the dialog/popup appears, however Facebook results with an error ("...
I have read many different resources but am still not sure if this is possible without using AJAX.
I have a javascript function that loads a div into a modal and says "Loading Please Wait" I have named this funciton loadingModal()
function loadingModal(url)
{
loadModal(...)
}
What I need to do is only trigger this after I have ...
this is my code in main.py
class marker_data(db.Model):
geo_pt = db.GeoPtProperty()
class HomePage(BaseRequestHandler):
def get(self):
a=marker_data()
a.geo_pt=db.GeoPt(-34.397, 150.644)
a.put()
datas=marker_data.all()
self.render_template('3.1.html',{'datas':datas})
and in the html is :...
Javascript:
can be run on web browsers with sproutcore/cappuccino.
can be run on web server with node.js/express.
can be run on mobile phones with appcelerator/phonegap.
can be run on the terminal as scripts.
Of course javascript will grows stronger on the latter three areas by time.
I read somewhere someone said something like:
"W...