javascript

Why would javascript work on my Sony Ericsson C510 browser, but not javascript + jquery?

I'm able to copy the following .htm file to my sony ericsson C510 and the mouseover works: <script type="text/javascript"> <!-- if (document.images) { front = new Image back = new Image front.src = "front.png" back.src = "back.png" } function swapImage(thisImage,newImage) { if (do...

How would I convert this jquery code into to standard javascript?

Since my cell phone apparently doesn't support JQuery, but does run the simple Javascript tests I have done, how can I convert the following JQuery code into standard Javascript? All I need this to do is have basic click-to-hide / click-to-show functionality. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/T...

IFrame document height returns the IFrame height not the real height

I have some javascript inside an iframe that sends the height of the iframe body to the parent page using the three frame technique at http://stackoverflow.com/questions/153152/resizing-an-iframe-based-on-content The height of the iframes body always seems to come out at 900, the viewport height of the iframe. This is consistent across ...

Calling setupWidget from the stage assistant in WebOS/Mojo

The scroller and other widgets in Palm's WebOS are commonly called like so: this.controller.setupWidget(Mojo.Menu.appMenu, {}, this.appMenuModel); within on of the JavaScript assistant files representing a 'scene'. My application is dead simple and requires only one view, so I'm not using anything other than the stage-assistant fil...

Jquery Ajax image load works only in FF. Suspect "race condition."

Dear learned folk, I made a web app that loads images using jquery, ajax and json. I got it to work in Firefox, but alas, Safari and Chrome remain stubborn. It has to do with a "race condition" where images don't load quickly enough, so I have a load event as well as a trigger event to wait until all images are loaded before appending t...

jQuery / JavaScript - string replace

Hi Assuming we have a comment textarea where the user can enter this code: [quote="comment-1"] How can I replace that code before the form submits with the actual html content from <div id="comment-1"> ? ...

JavaScript Object.create -- inheriting nested properties

Hi There, I've come across a peculiarity with Douglas Crockfords Object.create method which I'm hoping someone might be able to explain: If I create an object - say 'person' - using object literal notation then use Object.create to create a new object - say 'anotherPerson' - which inherits the methods and properties from the initial 'p...

Real time RSS display on web page (best practices and source codes)

Hello guys, i have a php script who parser a rss and give me the data in a know pattern. Im very new with ASP, JavaScript and Jquery so i dont have any idea of how to autoupdate the script and display the new data with a smooth animation (see this example, that exactly what i want). Thanks for the support and if you know a good script to...

Form plugin handling non-200/301/302 responses

I'm working with the jQuery Form Plugin. I have my servers send 200 responses on success, which trips the success listener perfectly fine. Per the standard, 301 and 302 and transparently redirected by the browser. However, when the server returns, say a 401, the Form Plugin just silently dies. How can I apply a listener to non-200 respon...

Generate XML document in-memory with JavaScript

I am working on a Web application that needs to send XML to a server backend. I'd like to build a XML document in-memory on the client-side, but using XML manipulation routines, instead of appending countless strings together. I'm hoping jQuery can help me out. Let's say I need to generate this (toy) XML document with JavaScript: <repo...

How would I read such a json structure?

{"some_id": [ {"city":"Bellevue"}, {"state":"Washington"} ] } ...

Changing a page element's style with javascript using the <a> tag and onclick?

I have a div block <div id='block'> <a href="#" onclick="Document.getElementById('block').style = 'display: none;';">Hide</a> </div> and I want to be have a link that will hide the block when clicked, I tried the above but it doesn't work I'm not sure how to get this to work, any ideas or guidance? ...

Offset time for DST in one specific timezone using JavaScript

I need to offset the time by an hour if it's currently DST in the Pacific Time Zone. How can I determine the current daylight savings status of the Pacific Time Zone, regardless of the user's local timezone? Here's what I have so far. "dst" in line 4 is just a placeholder for a function that would tell me if daylight savings time is act...

Unity 3D: code help (javascript)

Hello all; I'll get right to the point... I would like to display text and have a GUI option for leaving the scene once you collect 5 *wood. If you chose NOT to leave the scene than I would like it to disable the script "Timer" (Tagged 'Timer', In the Hierarchy its called 'Timer'). If you chose TO leave than I would like it to call the ...

Javascript: [] = 5, No Syntax Error? Why?

Yeah, it works in my firebug console. Why does something like this present no syntax error? [] = 5; [] = doThis(); [] = (function() {})(); Just curious about why it's allowed. ...

safari returning value "normal" for "line-height" style

Here is my problem : when i call document.defaultView.getComputedStyle(Node, "").getPropertyValue("line-height") safari returns the string "normal" when no line-height is specified, whereas firefox always returns the value in pixels. This poses me a big problem, especilly because I didn't found a reliable formula to get the numeric va...

Jquery - mousedown function with multiple class elements

Hi all, Im super new to Jquery so this may be a quick one. I have a mousedown function on a class named "thumb_resize". I have multiple divs named thumb_resize. So, the first time the mousedown function gets called it works perfectly, but it breaks when I try to call it from another element. Maybe its easier if I show you: http://www....

Need some input on making my Javascript code more efficient and functional

Basically, the code is used to check if 'required form inputs' have been entered before submitting the form. You setup the 'required inputs' by doing: requiredInputs( { 0 : ['name', 'age', ['phone', 'mobile', 'email']] }); The 0 represents the form index on the page. The first two values, name, age, are text boxes that must be ent...

Custom Control using default Page_ValidationSummaries attribute

Hi All, I wrote a successful Custom Button which can Validate multiple Validation groups on the same page. In doing so, I had to override the default Microsoft's ValidationSummaryOnSubmit method to suit my needs. ValidationSummaryOnSubmit method internally uses Page_ValidationSummaries property. function ValidationSummaryOnSubmit(vali...

Mark a position in eclipse text editor?

Hi folks, I have two questions: While editing a source file, it's very convenient to be able to label the current position of cursor and then jump to it later by somehow calling that label. I VIM, there is the marking notion, but I'm not aware of such possibility in Eclipse text editor. Is there any way in Eclipse to add a portion of ...