javascript

How to open new browser window using icefaces ?

How to open new browser window using icefaces JavascriptContext.addJavascriptCall(FacesContext.getCurrentInstance(), "window.open('printerFriendly.html','Print','width=300','height=200','menubar=yes','status=yes','location=yes','toolbar=yes','scrollbars=yes')"); but not able to open the page, please help me ...

Silverlight and Javascript interaction

I have a page with a silverlight app on it. Embedded in my page is an authentication key which the silverlight app will need to do all web service requests. So onload the silverlight app needs to get the key and do an initial connect to a WCF service. The problem is that its very unpredictable whether the page or the silverlight will loa...

Mootools add a class to 'a' href="something"

The situation is that I want to add a class 'display-none' to li eliment which has a child eliment 'a' <li class="mostread"> <a href="/intranet/Admin/Error-Pages/404.html" class="mostread">404</a> </li> i.e., if li class mostread has child element a href="/intranet/Admin/Error-Pages/404.html" and class mostread then add class 'di...

Prototype Hide All elements of a class

Hi, I can show/hide with IDs, however how do I do it with classes? $('black').setStyle({ display:'none', border:'1px solid red' }); For example that will work if I had #black, but what if I have .black? Thanks, ...

Is it possible to send json parameters as request data to webservice and get reply in xml format

I have the following code where i construct json data and send to the webservice ,my datatype will be json and response from the webservice will be in xml format does this logic work out or do i need to stick to any one particular datatype either json or xml. var keyword2 = "{\"keyword1\":\"" + keyword1 + "\",\"streetname\":\"" + addres...

find occurences of a class and if there is only one then hide with Jquery

I'm trying to hide a button depending on how many occurrences of a certain class there are. I am dynamically putting data into a page and for each dynamic div i put in i assign it the class "propdata" I need to count how many occurrences there are of "propdata" and if there is only one occurrence i need to hide the button with a class o...

Chrome: display: inline wierdness...

Hi, I'm stuck on a very strange problem, and I can't figure out what exactly is happening... Unfortunately, I cannot link to the page in question, as it is under internal development, but the problem is as follows: I have page with 3 links - A, B and C. Each of these links to dynamically generated files, and it can easily take several...

Bulk change HTML content using jQuery

I have several tds, with ids = row[0], row[2] row[4] and so on. <td id="row[4]">02:45</td> <td id="row[6]">03:45</td> The content in these are times like 03:45, 04:45 which I want to change to 03:15, 04:15 etc. using jQuery. EDIT: I ended up with this: jQuery('td[id^="row"]').each(function(){ min = parseInt(jQuery(this).text()...

get the href of one link and put it in the href of another link

I'm trying to grab the href of one of my links and clone/copy that to the href of another link Here's what i'm trying var link = $('.topbook'); var link2 = $('.sidelink'); var hrefOrig = link2.href; link.href = hrefOrig; Thanks Jamie UPDATE Here's is what I'm trying to get <a href="default.aspx?propid=BAR...

Download images and save locally on iPhone Phonegap app

Hi, I've already managed to save a web page (x/html) successfully, but I'd also like to save the images and mp4 videos that are contained in it, for further visualization in offline mode. I've got access to the iOS filesystem, so I save the html by obtaining the code through an AJAX request, and later saving it to a file. I don't real...

Is it possible unique user login in cake php

i want to know the code for at a time single user login on any browser or computer of a user. Can u help me. Thanxs, ...

use jQuery to ask if div got a background image?

Is it possible to use jQuery to check if #page has got a background image - #page could look like this: <div id="page" style="background-image: url(xxx)"></div> if it contains a background image, it should add a class to #page ...

Is there a way to specify text to appear on the bottom and header of every page when printed?

Is there a way to specify text to appear on the bottom and header of every page when printed? or Is there a CSS solution which would allow a header and footer to repeat on each printed page? thank you ...

Enums with jQuery?

$("#bc [id$=_dropdownID]").change(function() { if (this.value == '2' || this.value == '3') { $("#bc .pnl").show(); } else { $("#bc .pnl").hide(); } I have the following code in jQuery. Is there any way I can replace the hard coded constants 2 and 3 in the above code with a c# enum? Does jQuery support en...

MooTools onLoad SmoothScrolling (Lim Chee Aun Method)

From the post Lim Chee Un made here: http://davidwalsh.name/mootools-onload-smoothscroll window.addEvent(‘domready’, function() { new SmoothScroll({ duration:700 }, window); var el = window.location.hash.substring(1); // the hash if(el) { window.scrollTo(0,0); var scroll = new Fx.Scroll(window, { wait: false, duration: 700, transition: ...

Javascript injection

I would like to fill out and a submit a form explicitly with JavaScript. First, I thought I had to use window.open but it's certainly wrong because if it gets loaded, the left of my scripts written for example in a html file would be ignored. Do I have to create a .js file and fire that one? ...

jQuery validation plugin - partial validation depending on trigger

I am using the jQuery validation plugin and I would like to validate a floating point number and format it to a specified number of decimal places. I am using element.value = parseFloat(value).toFixed(param); to format the floating point value if it is indeed a valid floating point value, I just only want to do this on blur, not on ...

Gmail-like navigation

Like in Gmail, using PHP if we need to have similar functionality of navigating to different internal links, how could we do it? For example, from inbox, a specific email gets opened and when I click back button it takes me back to inbox. The addresses are https://mail.google.com/mail/?shva=1#inbox and #inbox/something for a specific e...

What's the origin of asking interviewees to manually parse a string as an int?

I'm wondering, what's the origin of asking interviewees to manually parse a string as an int? (without relying on any casting/type-conversion that may be built into the language). Is this a standard question, suggested from a book or list or something? Has anybody else here on SO gotten asked this particular question during an interv...

Javascript Base64 encoding UTF8 string fails in webkit/safari

I'm trying to base64 encode a utf8 string containing Thai characters. I'm using the browser's built in btoa function. It works for ascii text, however Thai is causing it to throw a INVALID_CHARACTER_ERR: DOM Exception 5 exception. Here's a sample that fails (the character that looks like an "n" is Thai) btoa('aก') What do I need to...