javascript

jQuery append doesn't work fully with <script> tag.

Appending a script element using jquery rather than putting it in the html by hand seems to lead to very different results. For instance snaphtml = '<script src="http:\/\/seadragon.com\/embed\/lxe.js?width=auto&height=400px"><\/script>'; $('#content').append(snaphtml); destroys the layout of my page, but putting the script element in...

Which javascript framework should i choose if I'm making one site for both medium Desktop PC and mobile phone?

Which javascript framework is most compatible with mobile phones and desktop both? javascript disabled user of desktop are very low but mobile phone users are high and i heard not all javascript functions work in mobile phones. ...

"text-decoration: blink" & IE

Why text-decoration: blink wont work in IE ? What is the work around ? Is there a non JS work around? Do Microsoft have a plan to support this style? ...

Converting / Stripping to iPhone Friendly HTML

Hi, I'm playing with some javascript for iPhone using Titanium Mobile. Being a newbie to JS, the challenge I'm at at the moment is pointing my app to a URL and converting/stripping the resultant full blown web page down to something that's iPhone friendly i.e. strip out page header images, other JS etc etc and just be left with the cont...

Convert simple Javascript script to PHP

I have a simple javascript function to validate a form (RSform!Pro in Joomla) on submit. Problem is bots are able to submit the form without the validate script running when they have javascript disabled. The only option I can think of to prevent this case from happening is to use php instead of javascript. Could someone help me with thi...

jQuery related problems. Default action going through, Javascript warnings and slideDown() being weird.

1 - I used to prevent the default action of an anchor tag upon click by doing the following... $('a').click(function() { /*stuff*/ return false; }); But then I decided to condense code by declaring a function that I could call within the click method since I use the same block of code elsewhere. So now it looks like... $('a').clic...

jQuery closest() not working for me (or i'm not working for it)

Given this jQuery: $('div.MvcFieldWrapper :input').focus(function() { $(this).closest('label.MvcDynamicFieldError').fadeOut(); }); And given this HTML: <div class="MvcFieldWrapper"> <label class="MvcDynamicFieldPrompt">Enter your email address:</label> <label class="MvcDynamicFieldError">Required</label> <input type...

Best tool for DOM manipulation ?

I'm working on a web scraper which will aggregate data from various websites. I've started using PHP's built in DOM functions but after running into a couple of issues (especially regarding malformed markup and character encoding), I've chosen to ditch PHP. I was thinking of server side Javascript but am open to other suggestions. If I g...

sense what screen size and adjust the column widths with javascript/jquery?

im using 960 and i want to adjust the nr of columns depending on the user's screen size. how do javascript/jquery get the resolution of the screen? ...

What's the easiest way to call a function every 5 seconds in jQuery?

I'm looking to automate the changing of images in a slideshow. I'd rather not install any 3rd party plugins if possible. Thanks. ...

Open source alternative to MagicZoom or Magneto ProZoom?

I'm trying to build a very simple site with that has a products section. I'd like to display a few views for each product, and the tools I've found so far are http://www.magictoolbox.com/ and Magneto, but both cost a bit. I'm not opposed to paying, if these are the best, but given how many lightbox clones there are, I can't believe there...

How can I stop a javascript from being interpreted after a certain point?

The first few lines of my script look like: if (window.location.hash) { window.location = window.location.hash.substring(1); } I'd like to have the entire script "skipped" if this statement returns true. Is there any way to do this other than putting my entire script in a giant if statement? Thanks. ...

how should i refer to the calling object within a handled keyboard event in javascript

hi I am writing a javascript widget which handles keyboard events. The issue in question arises when i show a div and want to hide it when someone presses esc. what's the best way to achieve the following (i am using jquery in this project ) var escToExit = function(e){ // code to check for esc // i then want to call the instance ...

sprintf url formatting in javascript

Hey guys, how do i write a function in javascript that can get the current url eg: http://www.blahblah.com/apps/category.php?pg=1&amp;catId=3021 and depending on a user selection choice, appends another parameter to the url like: http://localhost/buyamonline/apps/category.php?pg=1&amp;catId=3021&amp;limit=5 but heres the catch: Eve...

Time comparevalidator

Hi, I want to validate Time-Start and Time-End. The time format is like this 2:15:00 AM I want to make sure that the Time-End must be greater or equal to the Time-Start. The Time-Start gets the time from DropDownListHourStart(1-12) and DropDownListMinuteStart(1-59) and DropDownListSecondStart(00) and DropDownListAMPMStart(AM-PM) The T...

Java: Can HmtlUnit return the JavaScript redirect URL?

When HtmlUnit hits a JavaScript redirect, it will run through it without skipping a beat. If it hits one JavaScript redirect after another, it's impossible to tell which URLs it ran through -- only where it stopped. Is there a way around this? I would like to know the URLs it redirected through before it hit an end. I can disable norm...

Can the content remain centered while the screen size changes?

First, here's is my rough example: http://demindu.com/sandbox/simple.html What I'm trying to do: Create a content div: let's say 400px tall and 700px wide, like the example. The content box has a margin of 50px in each direction. The content div should always be centered both vertically and horizontally, regardless of screen resolution...

What are the benefits to using iframes for ajax long polling?

What are the benefits of using iframes for Comet long polling? Why not just keep an asynchronous ajax request in a script file pulled into the main page? Thanks. ...

Escaping quotes from Rails Variables when using them for Javascript?

Hi, I am having problems when trying to use a rails variable within javascript code. For example, I might define a link_to_remote, with parameter :complete => "alert('my_var');" If my_var = "I'm testing.", then the javascript code will break due to the single quote closing the code prematurely. If I try using escape_javascript(my_var)...

PHP/JS: How to implement dynamic breadcrumbs? (multi-window/tab compatible)

Hi, I'm working on a site where we need "dynamic" breadcrumb generation. Pages within this application are not specific children of the other, so when the user is browsing one of them, I can't simply retrace steps back up. I could have the following breadcrumbs-like lists: (updated) * inbox > message > user profile * search results ...