javascript

Cufon Hover & Change of font syntax

Could someone help me rewrite this syntax below to get it right. I want the font to be replaced by my font whilst accepting the :hover so my button will change when i hover over it. Cufon('button', { fontFamily: 'Disgrunged A', hover: { color: '#ed1c24' } }); ...

jQuery properties - problem

Hi, I use this plugin: jQuery.i18n.properties I put this code: /* Do stuff when the DOM is ready */ jQuery(document).ready(loadMessage); /* * Add elements behaviours. */ function loadMessage() { jQuery("#customMessage").html("test"); jQuery.i18n.properties({ name:'up_mail_messages', ...

document.URL Matching in Javascript

I have a url which looks like this https://test.high.com/people/11111111-name-firstname-_custa/deals/new Now i need to match document.URL if im on that Page if so i will alert a message. The important part is /deals/new How can i match that in Javascript? ...

Not Equal To notation in Javascript to use in jQuery

Hello, Is this the notation to use for Not Equal To in JS, in jquery code !== OR != None of them work Here is the code I am using var val = $('#xxx').val(); if (val!='') { alert("jello"); } Thanks Jean ...

Javascript replace content of string but not in start and end tag? pls help

Hi all i need your help ! i wanna write javascript function to change the text Lasvegas in string: ex: "Hello every one in Lasvegas, come <a href='xxx'>Lasvegas</a> with me" How can i change the text but not change content Lasvegas in start tag and end tag ...

InnerHTML while alerting it alerts with double quotes in firefox but not in IE.

Hi, I make innerHTML to get data and store it in database. When i tried in firefox it is coming proper with quotes(" or ') for attributes. But in IE i am not getting the quotes(" or ') for attributes. Is this a browser issue? Any answer for this. Thanks ...

Get Imagesize in jQuery

Hello, I want to get the imagesize in jquery, I have this code. It works to the point of alert (v); I wonder what is wrong with the rest when v actually contains a value. var v = $('#xxx input').val(); alert (v); var newImg = new Image(); newImg.src = v; var height = newImg.height; var width = newImg.width; ...

How to Open Multiple PopUp windows with JQuery on form submission (popUps should be relative to form submited data)?

I have A HTML form like this: <form> <fieldset class="ui-widget-content ui-corner-all"> <select id="Streams" class="multiselect ui-widget-content ui-corner-all" multiple="multiple" name="Streams[]"> <option value="35"> Example Name (35)</option> <option value="44"> Example Name (44)</option> <option value="5698"> Example...

What is a practical use for a closure in JavaScript?

I'm trying my hardest to wrap my head around JavaScript closures. I get that by returning an inner function, it will have access to any variable defined in its immediate parent. Where would this be useful to me? Perhaps I haven't quite got my head around it yet. Most of the examples I have seen online don't provide any real world code,...

image protection in rails

Hello, I am looking for ways to protect my product images and I don't know if there's anything out there better than what I've already found: disable right click, use a transparent image in front of your picture and watermarking. Obviously none of them is perfect but I was curious if someone came up with a better solution to this proble...

where is the best place to place a javascript snippet to alter the DOM of a page before it renders

I have a few dynamic pages and I want to alter certain elements before the page has fully rendered. My snippet is something like document.body.getElementById("change").innerHTML = "<img src..."; I do not have access to change the content server side. Where is the best place to put the snippet to have the code run before the page it ...

ModalPopupExtender inside a usercontrol, ID conflicts

Hello! I have a bit of a problem. I'm creating a popup usercontrol controled entierly on the client side. Inside my control i have a ModalPopupExtender. The problem is that when i create two or more instances of this usercontrol the ModalPopupExtenders ID is not unique per instance, i infact get many ModalPopupExtenders with the same ID...

Still confused about JavaScript's 'this'.

I've been reading through quite a few articles on the 'this' keyword when using JavaScript objects and I'm still somewhat confused. I'm quite happy writing object orientated Javascript and I get around the 'this' issue by referring the full object path but I don't like the fact I still find 'this' confusing. I found a good answer here ...

Calling a function when a scrollbar appears in an IFrame

I got an IFrame, in the onload event i set the height of the frame: function resizeFrame() { $("#iframeID").height($("#iframeID").contents().find("body").outerHeight(true)); } Problem is: When the content of the frame is increasing without a postback (javascript or Async Postback with Ajax), a scrollbar appears. I found a solution for...

Why not use javascript handlers on the body element?

As an answer to the question of 'How do you automatically set the focus to a textbox when a web page loads?', Espo suggests using <body onLoad="document.getElementById('<id>').focus();"> Ben Scheirman replies (without further explanation): Any javascript book will tell you not to put handlers on the body element like that Wh...

jQuery + Dialog Form Validation

I have a jQuery Dialog form and on submit I'm trying to validate the fields. I'm using jQuery Validation plugin to validate. In this I'm facing an issue, the validate function is not being called. I'm posting some snippet of my code: $("#register-dialog-form").dialog({ autoOpen: false, height: 350, width: 450, modal: tr...

How can give validation on custom registration form in drupal?

Hey Friends, I have created custom registration form in drupal 6. i have used changed the behavior of the drupal registration page by adding this code in themes. template file function earthen_theme($existing, $type, $theme, $path) { return array( // tell Drupal what template to use for the user register form 'user_register' =...

Checkbox checker JavaScript does not work. Escape?

Hello! In my form, my checkbox elements' name are onSite[]. I've made a simple JavaScript to check them with one click. function checkAll(field) { for (i = 0; i < field.length; i++) field[i].checked = true ; } And in the HTML a button which calls the function. <input type="button" name="CheckAll" value="All" onClick="checkAll(d...

Google Maps: Simple app not working on IE

We have a simple Google Maps traffic application up at: http://www.avonandsomerset.police.uk/newsroom/traffic/ For some reason it's recently stopped working in IE correctly. At this point in time it was using V2 of the API, so I've just upgraded it to use V3 - but it still won't work in IE. It works fine in Chrome & Firefox. But in all...

problem in leigeber's sorting

iam using leigeber's sorting javascript to sort my data on my page......i took the js from here :- leigeber's sorting javascript Now this is shwoing highlighted sorted column and all and its all perfect.Now iam having some negative and some positive values in my data and i want to show those negative data in red color and positive in g...