javascript

Best practice use sam AJAX in multiple browser windows?

Hey, I am developing a website that has some sort of realtime update. Now the website is generated with a javascript variable of the current ID of the dataset. Then in an interval of some seconsd an AJAX call is made passing on the current ID, and if theres something new the server returns it along with the latest ID which is then updat...

Why does my javascript not work

I have the folowing html. It passes the w3 validator, but my javascript alert does not work. Can anyone see any problems or have any suggestions on how to get it to work? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml"...

Why getting an outer HTML does not work ?

I try to get the outer HTML in two different ways, based on this question. Unfortunately, none of them is giving the expected result: HTML: <div id='my_div'>Hello</div> JS: $(function() { document.write('[' + $('#my_div').clone().wrapAll("<div />").parent().get(0).innerHTML + ']<br />'); document.write('[' + (new XMLSerializ...

How do i grey out the input field and the submit button

I want to grey out these two things the song input field and the submit button until the user enters and artist. Is there an easy way to do this via JQuery. the id of the artist input field is #request_artist ...

Does it make any sense to use JSLint and follow it?

Lately I've been writing some JS code using jQuery and JavaScript as it is and I thought I will give JSLint a try. Let me say that the code contains various functions and jQuery usages and it works fine (without any errors ) in IE8 and latest Firefox. The code also validatas as XHTML 1.0 Transitional (and Strict too but I mostly want it ...

Jquery - Send only some value from a form

Hi. I have this code : <form onSubmit="return checkTL();" method='POST' action='./index.php?general=example3' name='addtl' > <div class="sideon" id="sideline0"> <input type="text" id="inputside0" name="sides[]" class="inputTLS" maxlength="50" /> </div> <div class="sideoff" id="sideline1"> <input type="text" ...

<TR> Formatting not happening in Firefox

Hi, I want to hide/unhide a group of HTML Table rows using javascript. To do so, I define each such row, whose visibility is to be toggled, as follows: When an appropriate event is fired, I toggle its state as follows: document.getElementById('rowId1').style.display = 'none';//or 'block' The above code works in both firefox and IE. B...

Create a JavaScript array containing 1...N

Hi there, I'm looking for any alternatives to the below for creating a JavaScript array containing 1 through to N where N is only known at runtime. var foo = []; for (var i = 1; i <= N; i++) { foo.push(i); } To me it feels like there should be a way of doing this without the loop. Cheers for any ideas. ...

Block iframe from setting parent.location (prevent framebusting)

I have a website on my own domain where i include iframes to other sites on other domains for quick preview purposes. The problem is that some websites has framebusting code that redirects the user from my site. How can i stop this. Even not showing the iframe at all would be better than the redirect in the case of a framebuster. Shou...

Checkbox tree implementation - get selected checkboxes

I need to implement a Checkbox tree and I came across this component called jstree. It is a jQuery component and unfortunately I have no experience with Jquery. I followed the documentation and I have implemented my checkbox tree. The problem is with finding the selected checkboxes upon some event,say form submit. The API says,.get_check...

How to match "two or more words"

In a given string, I'm trying to verify that there are at least two words, where a word is defined as any non-numeric characters so for example // Should pass Phil D'Sousa Billy - the - Kid // Should Fail Joe 454545 354434 I thought this should work: (\b\D*?\b){2,} But it does not. ...

JavaScript POST request

How is it possible to enable the following JavaScript function, sending a POST request, to recieve productID parameter not as a single string variable but as a collection of productID's? i.e. to get in output a string like: "productId=126504&productId=126505&productId=126506&productId=126507&productId=126508" <script type="text/javas...

Image Switcher script conflicting with Add This script?

I added something called Varal Image Switcher to a client's web site several weeks ago. Clicking on the main image displays the next image. Here is the page: https://www.oldmanmountain.com/ Last week, I added this script from Add This: <!-- AddThis Button BEGIN --> <div class="addthis_toolbox addthis_default_style"> <a href="ht...

Facebook JS Integration Error

I have the following code right below the body tag of my application <div id="fb-root"></div> <script type="text/javascript"> window.fbAsyncInit = function() { FB.init({appId: '136904373......', status: true, cookie: true, xfbml: true}); }; (function() { var e = document.createElement('script'); e.async = true; ...

Calling C++ function from JavaScript script running in a web browser control

I have embedded a web browser control in my c++ application. I want javascript running in the web browser control to be able to call a c++ function/method. I have found mentions of three ways to do this: Implement an ActiveX component that acts as a middle man. (Implementation details here: http://blogs.msdn.com/b/nicd/archive/2007/04...

Use BlobstoreService and ImageService to upload/serve images drawn from an HTML5 canvas

I'm working on an Appengine application in Java that allows users to upload images drawn through an HTML5 canvas library called PaintWeb (http://code.google.com/p/paintweb/). Currently I have a servlet that receives the XMLHttpRequest POST from the paintweb javascript library as a formencoded image. Paintweb.js library sends XMLH...

How do you pass an argument in Telerik's RadListBox OnClientSelectedIndexChanged event?

How do you pass an argument in Telerik's RadListBox OnClientSelectedIndexChanged event? It seems the method you call with this event is <script type="text/javascript"> someMethod(sender, eventArgs) { var ajaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>"); if (ajaxManager != null) ajaxManager.ajaxRequest("Lis...

OpenLayers: disable zooming on double-click

OpenLayers, by default, zooms in when a user double clicks a map. What is the best way to disable this behavior? ...

File drag&drop, detect when dropped outside ?

I'd like to modify the default behavior of my browser when drag&drop-ing a file in my webapp (html5). By default, if you drop a file outside a dropable box the browser tries to open it and quit the current page. On gmail, this is desactivated! Have you got an idea how this is done ? I was thinking about the onbeforeunload event but it ...

PHP CURL Javascript problems help?

<script type= "text/javascript"> /*<![CDATA[*/ $(document).ready(function(){ $('form.upform').submit(function() { $(".file").animate({"height": "toggle", "opacity": "toggle"}, "slow"); $(".loading").fadeIn("slow"); }); }); var max = <?=$settings['SET_MAX_UPLOAD'];?>; var count = 1; $(document).ready(function(){ $('.add...