javascript

Too many setTimeout in IE

I use comet to update my page content, and show the update effect by adding a class and using setTimeout to clear the class. If there are a lot of updates coming, there will be a lot of timers on the page. In firefox, this is still working fine, but in IE, the color is not cleared within the timeout i specified. Is there any problem if t...

Is it possible to trigger the onbeforeunload event programmatically?

I'm currently using the jquery-form-observe plugin which uses onbeforeunload to prompt the user about "unsaved" changes. But I have a scenario where I need to trigger this on a button click: the button click ultimately leads to the page changing, but I want to prompt the user before they start the process that the button click kicks of...

Why is Container.DataItem being passed as a string literal?

I'm trying to pass a string value to a javascript function from a LinkButton's OnClientClick event, but the function is receiving "<%# Container.DataItem %>" instead of the value. Here's the code: OnClientClick="javascript:SaveQuotaGroupCode('<%# Container.DataItem %>');" The container is a collection of strings. Why is it not evalu...

Update an UpdatePanel manually using JavaScript or jQuery

Is it possible to update an UpdatePanel manually using JavaScript or jQuery? What I have is a TextBox at the top of my page. When a user leaves that TextBox I want to run some server code (it will add a record to my database) then at the bottom of the page I have an UpdatePanel which will get refreshed. The UpdatePanel has a GridView wh...

What is better for performance: Update specific cells or replace entire table ?

My project requires that I update the contents of a specific column in an HTML table via an AJAX call to a PHP script. In terms of workload: The table contains about 4 columns and about 20 rows (more rows could be added with time). What would be more (or most) efficient: Replace ONLY the column/specific cells that need to be updated...

Virtuemart breaking my js sliding submenu's

I am having an issue with a javascript sliding menu. It is for a joomla website using virtuemart. Please take a look at dev.indigoniche.com ... (this keep redirecting back to the live site because of a cookie issue but when that happens just go back to the dev area) If you use the + and - next to some of the menu items you will see the...

Dynamically chaning PHP variables

I have a website that grabs a random entry from a database and displays it for the viewer. This is the code I am currently using: $rows = "SELECT * FROM xxx"; $rows1 = mysql_query($rows); $rows2 = mysql_numrows($rows1); $id= rand(1, $rows2); This generates an ID number which is used to select a corresponding database entry, and of cou...

free javascript obfuscator ?

hello, thanks for your attention and precious time. Please mention some free javascrpt obfuscator software that can compress, obfuscates and encode javascript for protection. I serached but could found web based only and those which are free and desktop are not good. Please guide and help me. thanks ...

Display current URL of webpage (dynamic) in HTML

I have this code in my HTML: <h3 id="left">Lorem Ipsum </h3> <h3 id="right">[Current URL Here]</h3> I want to display (dynamicly) the current URL inside the <h3> tags. I've been trying to figure it out for a few days, but I'm really a mobile developer, not an HTML developer, so it's proven difficult. I need this for a...

Display data in tree structure

I want to display data in tree strucure using Javascript. The data should be read from xml file. These data should be be displayed in tree structure. and i need to keep track of the level numbers also.Please help me out. Thank you in advance ...

Javascript rounding v c# rounding

Hi, I have an invoice page in ASP.NET MVC. I am calculating GST. In javascript this the result. 165.45 * 0.1 = 16.544999999999998 In C# I get 165.45 * 0.1 = 16.545 These round differently I want to round both to 2 decimal places but they give different answers Javascript = 16.54 C# = 16.55 Which is what I want. Any ideas h...

Problem with javascript switch statement..

elmid = "R125"; switch(true){ case elmid.match(/R125/): idType = "reply"; break; } alert(idType); // Returns undefined -------------------BUT---------------------- elmid = "R125"; if (elmid.match(/R125/)){idType = "reply";} alert(idType); // Returns "reply" Using the swtich returns undefined but using an if ...

validating json string using javascript...

I have this json string {"Table" : [{"subject" : "No Records are there to Display"}]}. If i receive this data i want to alert NO Records Found. Any suggestion. Note: My key field may vary accordingly (ie) here it is Subject and some more like Details,Description. ...

How to show ajax modalpop up using jquery?

When i click on a button in the repeater, i wanna display an ajax modal popup using jquery. I am trying to do that, but its not getting displayed. How to solve this issue? Any suggestions??? ...

how to delegate this in javascript?

var selValues = {}; selValues['234'] = $('#asd').val(); selValues['343'] = function () { var el = ''; $('#asd input[@type=checkbox]:checked').each(function() { el += $(this).val() + '|'; }); return el; } }; here's the explanation: im creating a key-value array where it extracts different values from DOM objects. The last array that yo...

Problem with keeping selected value in form after reloading page

Hey! I'm trying to populate a second dropdown in a dynamic way based on a previs selected dropdown. However, I've managed to write get the page to reload when I choose anything in the dropdownbox but the chosen value isnt passed after reloading. I have register_globals turned off (and prefer to) and i'm using the GET function to submit ...

how change content by CHANGE event and save/hold last cursor position

I want clear content by change event and save last cursor position ed.onChange.add(function(ed, o) { var newContent = o.content.replace(/SOMEREGEXP/ig, ""); ed.setContent(newContent); //ed.selection.select(ed.getBody(), true); //ed.selection.collapse(false); }); How can this do? ...

Passing dynamically Data Object in the data using AutoSuggest jQuery plugin

AutoSuggest jQuery Plugin requires an already available Data Object in order to run. I need to use the user's selection from the first input as data in the second input. The following snippet throws an error in firebug availableTeachers is not defined var labs = {lesson: [ { ...

identify the selected td using javascript in html

Hi I have a table which contain 100 rows and td. like see below <table border="0" cellpadding="0" cellspacing="0" id="artcle-title" > <tr> <td>Artcle details 1</td> </tr> <tr> <td>Artcle details 2</td> </tr> <tr> <td>Artcle details 3</td> </tr> <tr> <td>Artcle details 4</td> </tr> .... </table> When a us...

Calling multiple jQuery functions in an ASP.NET page

I have a page with three HTML labels and their corresponding ASP.NET gridviews contained within divs. Now while learning jQuery, I am trying to achieve two things: 1. Change the css class of the lables upon mouse hover/out. 2. Slide up/down the grid div upon clicking of the labels. It looks to be working as expected, but I wish to know i...