javascript

Object property "Previous Value" in Javascript

I'm just starting to get my mind around this whole Object Oriented thing, so bear with me. So, I saw an example of an object function (for Javascript) where you assign a new value and that value gets assigned as that property's actual value. Example: function Meat (name, color, price) { function newPrice (new_price) { this....

How to parse an excel file in JavaScript?

I am trying to write a small web tool which takes an Excel file, parses the contents and then compares the data with another dataset. Can this be easily done in JavaScript? Is there a JavaScript library which does this? ...

Tab order issue in IE with initial Javascript select of field in form

I'm trying to achieve the following behaviour in html: user is presented with a form involving several text fields. The fields are populated with default values, but in many cases the user will wish to enter their own. When the page loads, the value in the first field is selected, so the user can either replace it by simply starting t...

How to avoid name clashes in javascript widgets

I have a javascript widget (a piece of embedded JS and HTML code) that's embedded on other sites. What should I do to make sure it's variable names don't clash with the hosting page variables? I'd like this widget to be "inlined" meaning on the same page as the hosting page, not in an iframe, what's the best way to avoid name clashes wi...

How can I hide elements which only contain hidden DIVs in jQuery?

I want to hide all blocks which only contain hidden DIVs (aside from a caption). All elements have to be selected via class names. In detail, I want each "eventBlock" not to show up when all "groupBlocks" underneath are already hidden. The same with "Menu" which should not show up when all child eventBlocks are hidden. Each "Menu" cont...

events not registering after html being generated with $.post callback

I have some input checkboxes that are being dynamically generated in a $.post callback function. Then i have a $().change() call that does things when the value is changed (alerts some info). However, for the dynamically generated inputs, the .change() does not work. There are other inputs that work that are hardcoded into the html that ...

Losing newlines in div content in IE 7

I'm trying to split the innerText of a div on the newlines in the source for it. This works fine with: $('div').text().split("\r\n|\r|\n") But this fails in IE 7, due to the newlines apparently being stripped out. jQuery 1.3.2 doesn't appear to be at fault since i also tried both: $('div')[0].innerText.split("\r\n|\r|\n") and $('d...

javascript math equation

I have two form fields money and years that need to output a number into a third field cv . Ideally while the first numbers are being entered but I'm OK with it happening after a button is pressed as well <FORM name="salary"> <input type="number" size=12 name="money"> <input type="number" size=12 name="years"> <input type...

Replace browser content with new URL

I need to reload the browser window with a new URL which also will replace/flush content and force reload of the page. window.replace() or window.location doesn't work, any other function I could use ? ...

How do you resolve a hidden javascript link with php?

Hi, I'm trying to parse a bunch of webpages one after the next with PHP, but I noticed that when I fopen the first page, the links to the following pages are hidden in javascript. Is there anyway I can continue on to parse the next webpages? If the url had a variable like "page=2" encrypted into it I would go through them that way, bu...

Stack Operation in Javascript

I am implementing a stack in JavaScript. Consider: Stack{0,1,2,3} Top:0 Now the user pops the value of 2: Stack{0,1,3} Top:0 Is this an acceptable behavior for a stack? I am rolling my own stack, but is there any built in code that would do this for me? My Code: function Stack() //Creating Stack Object { // Create...

Debugging Javascript in ASP.NET

I was wondering if the type of javascript errors can be grouped into different categories and if there was an easy way of debugging them. While working on a ASP.NET application, I generally see 2 different types of JS errors: Ones that say "Error occurred in xx. Do you want to debug"? Ones that show errors with a icon on the bottom lef...

How can I get the index of this element with jQuery?

Hi... I am trying to get the index of an element using jQuery to send to a PHP script. Here is my XHTML <form action="/accreditation/questions/" method="post" id="questions-form"> <fieldset id="question-0"> <legend>Question</legend> <h3>What colour is grass?</h3> <ul> <li><input type="radio" n...

What's the best way to get this data to persist within Javascript event handlers using jQuery

My code is meant to replace radio buttons with dynamic ones, and allow clicking both the label and new dynamic radio element to toggle the state of the hidden with CSS radio box. I need to send to questions.checkAnswer() three parameters, and these are defined within these initiation loops. However I always get last the last values once...

What happened to Rhino? Is it still under active development?

The last release was in 2008-03-06. What happened to it? Is it still under active development? Are there any replacements? ...

How to re-render the panel to different div when panel already render to some other div

I have created a Ext.Panel object, it rendered properly to specified div element on my page. I want to replace the panel object underlying element(previously rendered div element) to another div which will be identified dynamically. Here I don't want to create the Panel object once again by specifying identified div element, I need to...

How to change Action attribute of the aspnetForm on MasterPage dynamically

We are trying to modify the Action attribute of the main ASP.NET form in the master page dynamically. The page has a radio button, user selects one of the options and clicks on submit, on postback, based on the selection the Form's action attribute should be set and the form should be submitted again automatically. We were trying to u...

Javascript library wanted for XML editor programatically generated from XSD

I want to create a web based interface to configure a system. My systems configuration is defined using XML for which I have an XML schema. I am looking for a Java Library which takes this schema and automatically creates a nice web based interface for viewing and editing the XML configuration document. It would be nice if this library ...

How to re-render the panel to different div when panel already render to some other div

I have created a Ext.Panel object, it rendered properly to specified div element on my page. I want to replace the panel object underlying element(previously rendered div element) to another div which will be identified dynamically. Here I don't want to create the Panel object once again by specifying identified div element, I need to...

Prototype/Scriptaculous: Selecting groups of paragraphs (<p>) by clicking on them.

A list of paragraphs (<p>) is given. As soon as the user clicks on paragraph A the class of paragraph A changes to "activated". Now the user selects paragraph B and all the paragraphs between A and B change their class to "activated". By clicking on B again, only A remains with the class "active". By clicking on A the class "active" ...