javascript

loading remote page into DOM with javascript

I am trying to write a web widget which will allow users to display customized information (from my website) in their own web page. The mechanism I want to use (for creating the web widget) is javascript. So basically, I want to be able to write some javascript code like this (this is what the end user copies into their HTML page, to ge...

Onclick event handler is executed several times when I click on a link

I have an event handler that is called six times when I click on a link. var elems = elem.getElementsByTagName('a'); var cntr = 0; for(var a in elems) { AttachEvent(elems[cntr], 'click', function(e) { this.reporturl = this.href; document.getElementById('reportpopup').style.visibility = "visible"; return false; }); } I ...

What is the difference between having a function in Jquery.Document and not having it in.

Hi I am just wondering what is the difference between these two File1.js $(function() { function MyFunction() { // some code here } }); File2.js $(function() { // call it. MyFunction(); }); File1.js function MyFunction() { // some code here } File2.js $(function() { // call it. ...

Remove Quote in Regex Matching

I have the following string: [assembly: AssemblyVersion("1.0.0.0")] The issue now is that I have to extract the 1.0.0.0 out. Here's the regular expression that I can come out with: var pattern = "[^\\/]+\\[[a-z]+:\\s" + "AssemblyVersion"+ "(?:Attribute)?\\((.+)\\)\\]" ; var theString ="[assembly: AssemblyVersion("1.0.0.0")]"; var...

Hybrid static/dynamic Google Map

Ever noticed that when you go to maps.google.com and do a search (say, car wash), it renders a lot of results (represented by small circles) and a few prominent ones (seen as regular-size pins)? Notice how quickly it does this? From what I can tell from analyzing this in Firebug, much of this is generated on the server and sent to the ...

How to display a string, based on number in a form with JavaScript

I have the user entering a post-number in a form-field, and then I want to display the town with that post-number. I have the server-side function set up, it takes a variable from the URL and returns a plain string. As I see it, I need to get the variable from the form-field afterthe user has written it and the focus has left the form-...

jQuery dragging divs selected text

Hello, I'm using jquery to make a few divs draggable on a website. My code is similar to this: $("#thediv").bind('mousedown',function(){ $(document).bind('mousemove',function(ms){ //drag }) }); The problem is that if the mouse is too fast for the div, the mouse goes outside of the div. This selects random content on the ...

how to call javascript in child page on load event

Hi, I have an asp.net application with an aspx page. In page_Load event of the aspx page,m handling some code which is based on the hidden variable value from the javascript(assigning result of javascript to hidden variable). I am calling the javscript in page_load of child page and in the immediate statement, m making use of the hidden...

How to check if memory leak occurs when removing an element out of DOM?

<div id="target"> ... </div> $('#target').html('') will remove the content,but how to check if the listeners or anything else that holds memory is removed at the same time? ...

Japanese Text are displayed as garbled text in Eclipse for non java/jsp file like js/inc

I would like to ask how can i display Japanese text in Eclipse properly. I work in Japan and the code we have has a lot of Japanese characters. I just notice that for .java and .jsp file, that all the Japanese comments and text are displayed properly as Japanese. However, for other filesm such as js (Javascript) file or inc (include) fil...

Run JavaScript in DreamWeaver CS3

Is it possible to have javascript execute in the design view of DreamWeaver CS3? Specifically i would like to be able to have custom tags like: <myTag:Custom type="flappers" /> render in the DW CS3 IDE as: <div class="flappers">User would see this text in designer but not the div tag</div> Im assuming security restrictions would p...

How can I open a new tab or window when a link is clicked?

I have same ancors/hyperlink in my html file. These point to a new website outside my site. So I want that when the user clicks the link it should open a new tab or window. My website page should not be closed. How can it be done? ...

Unable to read array after eval(responseText) + Javascript + JSON + Rails

I pass activerecord data from rails to JavaScript function as JSON using ajax. my request.responseText looks like this [{"site": {"lng": 55.1443, "lat": 25.0608}}, {"site": {"lng": 55.1065, "lat": 25.0399}}] Below is my JavaScript code var sites=eval('(' + request.responseText + ')'); for (var i = 0 ; i < sites.length ; i++) { ...

set Image and lable text in javascript

Hello everyone.. In my application, I have a Javascript function which get called after every minute. This javascript function returns me new comma seprated string each time which contains image path and image name. I simply split this string and set the Image path to image and text to lable. Goel is to achive effect like image slide sh...

firefox BUG for innerHTML iframe TAG

In the absence of the download is complete before using the innerHTML will cause pages to load iframe disorder In the following example, the first Click "openA" (google page), then "openB" (yahoo page), and then "openA", then A window shown on the wrong yahoo page. The BUG in chrome and IE does not exist under. How to avoid this pr...

php script/program to view/edit/copy/paste XML data in grid/table format?

Anyone know of any software like this? I've found many datagrids that can handle XML, but none that allow copy and pasting or cloning/duplicating of row data. ...

Firefox : Open XLSX file not saving file butn opening binary.

Hello, I generate a file server side and I want the client to automatically open it : it's a XLSX file. Firefox just opens the file and I see the binary content of the XLSX file in the browser, but I want it to be open via a Save As... box. It works fine in Chrome with the same code (it saves it) but not firefox... Any ideas ? ...

select element by css

I have many lines on my page generated from database with PHP. Each line is in DIV. I'd like to "select" a line by clicking on it. "Select" means change css for it. What is the easiest way to do it? ...

parsing new lines in jquery

I've recently asked and had answered this question and it's stopped the issue of the string literal error, however it's now caused another problem $(document).ready(function() { $("#message-list .message").click(function() { var msg_id = 1; msg_id = $(this).attr('id').split('-')[1]; $.ajax({ type: "GET", url: "ge...

Difference between using var and not using var in JavaScript

What exactly is the function of the var keyword in Javascript, and what is the difference between: var someNumber = 2; var someFunction = function() { doSomething; } var someObject = { } var someObject.someProperty = 5; and: someNumber = 2; someFunction = function() { doSomething; } someObject = { } someObject.someProperty = 5; Whe...