javascript

GWT MapWidget from javascript as GMap2

Hi, I am using GWT for google map application. I use Google's gwt-maps.jar for mapping api. I can create a map as private MapWidget mapId; if (Maps.isBrowserCompatible()) { mapId = new MapWidget(); mapId.setPixelSize(600, 500); RootPanel.get("gmap").add(mapId); mapId.setCurrentMapType(MapType.getHybridMap()); mapId...

Original Markup inInternet Explorer in Range / Selection

I am extracting content selected by the user via this function: function getSelectionHTML() { var userSelection; if (window.getSelection) { // W3C Ranges userSelection = document.getElementById('axPage').contentWindow.getSelection(); // Get the range: if (userSelection.getRangeAt) var range = userSelection.getRa...

Javascript: Global variable within function

Hi, Is there a way to set a global Javascript function within HTML. I can only pass it as a function like PostComment(this.content) So i can only access it inside the PostComment function. Is there a way to access it in another function? ...

Javascript function for trilinear interpolation

All, I THINK that I'm looking for a function for Trilinear interpolation. Here's the details: I have a three dimensional dataset: Dimension 1 varies from 0 to 100 in increments of 5 Dimension 2 varies from 0 to 100 in increments of 5 Dimension 3 varies from 0 to 1 in increments of 0.1 So, I have 4851 total values (21 x 21 x 11). ...

Detect browser support for cross-domain XMLHttpRequests?

I'm working on some Javascript that makes use of Firefox 3.5's ability to perform cross-domain XMLHttpRequests… But I'd like to fail gracefully if they aren't supported. Apart from actually making a cross-domain request, is there any way to detect a browser's support for them? ...

Jquery url replace

How can I modify this: /services/type/single_dwelling/ to this: /ajax/services/single_dwelling/development Currently I have: linkUrl = $(this).attr("href").replace(/(\/(services)\/)/, "$1ajax/"); Which outputs: /services/ajax/type/single_dwelling/ I'm a little confused. ...

jQuery plugin: Validation can't be customized without setting all fields to 'required'?

I've spent the day looking at jQuery plugin: Validation by Jörn Zaefferer. I notice that it works fine as long as you call the validate() method without options. In my little squalid world, as soon as I add options, like errorPlacement, I notice that validation ignores form fields that are not marked required. I also notice that many, ma...

How to build a string with the value of a variable embedded?

HI, I've got: <script language="javascript" type="text/javascript"> $(document).ready(function() { $("#thumbs a").click( function() { var BGswitch = $(this).attr("href"); $("#target").css("background-image", "url(BGswitch)"); return false; }); }); </script> And it's not quite working--when I look at the code, ...

How to detect if visitor is still on website (besides polling)?

Is there a simple way to detect if the visitor is still viewing a page on a web page that does not require polling the server every X seconds? If there was something less taxing on the server, that would be ideal. ...

How to get client IP address using jQuery

Hi All, I want to know how to get client IP address using jQuery?is it possible?I know pure javascript cant, but got one code using JSONP from Stack overflow itself .so, is there any workaround using jQuery? Thanks for ur help. ...

change the Style Attribute value

How can I get and change the Style Attribute property value Example <div id="styleChanger" style="color: rgb(163, 41, 41);"> // some content </div> How can I change the Style property color value ...

Quickest way to find an element with jQuery

Given the following html: <tr> <td>Content</td> <td>Content</td> <td>Content</td> <td><img id="imgProductPurchased" runat="server" visible="true" alt="Product Purchased" title="Product Purchased" src="/sitecore/shell/Themes/Standard/Applications/16x16/checkbox.png" /></td> <td> <asp:PlaceHolder ID="plhPurchased" runat="serv...

Joining each item of an array with the items of another array

Consider this: [ ["a", "b"], ["c", "d"], ["e"] ] How can this be tranformed to: [ "a c e", "a d e", "b c e", "b d e" ] ...

jQuery CSS Hover

I have a CSS menu that sets the parent li's color when hovering over it and it's child ul (submenu). Basically, when you hover over the menu, it changes colour and remains that way until you mouseoff the menu and it's submenu. It looks nice. I've added some jQuery code to change the colour of the menu items when until a certain page is ...

Do Javascript prototypes have something equivalent to Lua's __index & __newindex?

I want to define a behavior on Javascript objects that kicks in when the referenced attribute/method doesn't exist. In Lua you can do this with metatables and the __index & __newindex methods. --Lua code o = setmetatable({},{__index=function(self,key) print("tried to undefined key",key) return nil end }) So I'm wondering if there...

How to change the Content of a <textarea> with Javascript

How would I change the content of a <textarea> element with JavaScript? I want to make it empty. ...

iframe (javascript) + correct url

i have a domain full-ops.com that i transferred to another host, but it takes 5days to transfer it. So what i want to do on my old host is make an iframe that loads in the site from the new host. so that the user can type in full-ops.com and go to the new site. but is it possible through javascript or any other thing to have the correc...

semi transparent background color but not the Text

How to show the div content with semi background color but not the text value Example: <div style="height:25px; background-color: red;"> Content </div> I want to display the div background as semi transparent and text as normally while the onmouseover event. How can I do that. ...

double qoutes in variables causing javascript error

In my below code when the $artist or $title variables contain " it causes the JavaScript command to break. Is there another way I can encode these other than addslashes() to fix this? $artist = addslashes($row['artist']); $title = addslashes($row['title']); echo '<div class="play" style="display: inline"><a href="javascript:playSong...

Is it possible to create a form using only JS?

Hi All, I am trying to create a form using only JavaScript. I mean create a form for a web page, add elements to it, set their values and submit the form. Moreover, if JS is disabled in the browser the normal HTML form should get submitted. Is there any way to achieve this? Thank You All. ...