javascript

Google Maps v3 API Extend Bounds. Javascript How-To?

function initialize(){ // Creating a map var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(53.0123601276819, -2.44519164333635), mapTypeId: google.maps.MapTypeId.ROADMAP }); var m = []; function addMarker(title, lat, lng) { m[m.length] = new google.maps.Marker({ position: new...

Tried to validate my page, I have an error on my <script> tag, missing attribute?

Line 207, Column 50: Required attributes missing on element script. <script type="text/javascript" charset="utf-8"> Element-specific attributes for element script: Global attributes src async defer type charset What is it that I am missing? Thankyou Edit: This is for all of my handwritten code, I don't wa...

reset a form to the default values

Currently I have: $("#your_email").val(this.defaultValue;) I want to be cycling through all form elements and resetting them to their default value ...

Javascript: How can I transform an array?

I have this on a javascript var: (it's a http returned data, and I don't know if it's an array or string - (how can we see that?) - Update: using typeof returned "string", so it's a string. [{"nomeDominio":"gggg.fa"},{"nomeDominio":"rarar.fa"}] How can we pass/transform that, into something like this: ["gggg.fa","rarar.fa"] ? Than...

search an address using google maps javascript API

i have created the following function to show and address in JS: function showMapForm(idDiv, divWidth, divHeight, idLat, idLng) { document.getElementById(idDiv).style.width = divWidth+'px'; document.getElementById(idDiv).style.height = divHeight+'px'; if (document.getElementById(idLat).value=='' && document.getElementById(id...

Make mouse clicks unresponsive when text are selected.

Dear experts, I am currently working on a WYSIWYG web editor. The problem i ran into is a little complicated. When I select a section of text and click on something on my tools, the command works but immediately the text becomes unselected. Just like when we select text in any webpage, when we click on something else, the text become...

Having the correct value of 'this' in JS

I have two Javascript "objects" similar to so.... var Object2 = new (function() { this.FetchData = function(callback) { // do some stuff callback(data); }; }); var Object1 = new (function() { this.DisplayStuff = function() { }; this.LoadData = function() { Object2.FetchData(this.OnData); ...

Body persitant inline style in ckEditor

I'm trying all day to set up a peristant style attribute to the body tag of the ckeditor instance. I could not find something like bodyStyle in ckeditor.config api (only bodyId and bodyClass). So I was trying it myself, with the following solution (jQuery is used): $(this).find('textarea.editor').ckeditor().ckeditorGet().on( 'instanceRe...

javascript setInterval on an object's function only calls 2x

var focus = true; function z() { this.t = 0; this.p = function (t) { if (focus == true) { this.t = t; alert(this.t); } } } var zp = new z(); setTimeout('zp.p(0)', 100); window.setInterval('zp.p(1)', 2000); var ftimer = setTimeout('focus=false', 2000); document.addEventListener('mous...

Correct way to prevent memory leaks on DOM event listener

Some stupid question about DOM, please don't hate me For some reasons I need to pass an anonymous function to addEventListener (mainly to "pass" context variables) but the listener once called can be removed so I want to understand if the code shown below is the correctly way to detach the listener. var item = document.createElemen...

How to make jQuery.getJSON () output image support for lightbox slideshow?

The way it is, I learn the methods by jQuery.getJSON , I tried to made a small album with dribbble's api. I would like to click on pictures to enlarge, (slides). I according jquerytools and fancybox the demo format output. But the strange thing is that The things we do not have a slide effect. However, the output of the html copy ...

I have to restart firebug/firefox many times a day. Is it Firebug, or is it me?

After an hour or two of heavy use on the site I'm developing, Firebug develops the following problems: Breakpoints get glitchy -- it becomes difficult to add/remove breakpoints. Sometimes I click on a line multiple times, see nothing, move to the console tab and back, and then see my breakpoints again. Console stops logging xhr's, or s...

How to implement "mouse resistance" in javascript?

Hello, i need to implement mouse resistance in javascript. As an example of what i mean, think of how the Enligthenment window manager handles screen edge resistance to switch between different desktops, or if you are not familiar with that: imagine a large rectangle with a square within it. when click-moving the mouse [onmousedown] wi...

Chrome extension issues with contact scripts

I think I am having trouble visualizing what code goes where and what requests and responses go where. Let's say I want to alter all <img> tags in the body of a document. I am sure I would adjust there styling in the inject.js file,...but would I still need to send a request to background.html? If so,...I am not sure what the respons...

Mootools return to top of containing div?

I use a mootools-based pagination which works fine. However, I would like after a user clicks to a new page (from the bottom where the pagination links are clicked) to return the new set of comments and scroll back up to the top of the container div. Is there a function to do something like that with mootools? Here is the code that ne...

SyntaxError while placing Javascript in PDF

I am trying to apply some javascript to a pdf to make it print silently. I found this chunk of code and pasted it in, but get the error below. SyntaxError: missing ; before statement 1: at line 2 This highlights the first 2 lines of the code below: Document document = new Document(); FileOutputStream fos = new FileOutputStream("...

How to execute JavaScript in Visual Studio design mode?

I have a JavaScript that generates HTML on my web page (AJAX control). Now I need to create a ASP.NET Control that is visible at design time. It should look exactly like the original AJAX control. Any ideas about how to execute JavaScript at design time? Unfortunately I cannot create all the required HTML in .Net as it is too large and c...

Posting to YouTube API with jQuery

I am trying to post a request to the google authSub for youtube. I use jQuery for AJAX posts etc. When I make the POST I get a 405 error: "405 Method Not Allowed". Here is my js: $.ajax({ type: 'POST', url: "https://www.google.com/accounts/AuthSubRequest", beforeSend: function(xhr){ xhr.setRequestHeader('X...

How can I disable the scroll bars of a page?

how to disable the scroll bars of the page. and disable this button. ...

System Information in Browser

Hi, we have a license key system which requires the MAC address of the network card of the PC. To make it easier for the user, I am looking into getting the MAC address (or some other similar system identification info) with a web page. Do Flash (or Flex), JavaScript or Java Applets provide any APIs to query system information ? Than...