javascript

Paging Through Records Using jQuery

I have a JSON result that contains numerous records. I'd like to show the first one, but have a next button to view the second, and so on. I don't want the page to refresh which is why I'm hoping a combination of JavaScript, jQuery, and even a third party AJAX library can help. Any suggestions? ...

Problem JavaScript retrive information

Hi All, Premise: I've started to study javascript and the DOM and I have this HTML fragment: <body> <div id="Area_T10" class="abAdArea"> <script src="http://ad.dc2.adtech.de/addyn/3.0/831/***1644116***/0/744/ADTECH;" language="javascript1.1" type="text/javascript"></script> <script> ** -- My script var n = ** ...

JavaScript RegExp objects

Hi! I try to write a simple Markdown parser in JavaScript. Therefore I want to check for the [link content][link id] syntax. I use the following code: data = data.replace( /\[(.*?)\][ ]*\[([0-9]+)\]/g, '<a href="$2">$1</a>' ); It works well, but now I want to do this with a RegExp object. So I set up the following bit of code: var r...

How to get the page's full content as string in javascript?

Hi, I'm writing a bookmarklet, i.e. a bookmark that contains javascript instead of a URL, and I have some trouble. In fact, I cannot remember how I can get the content of the page as a string, so I can apply a regular expression to find what I want. Can you please help me on this? Before anyone suggests it, I cannot use getElementBy(I...

Overriding a JavaScript results in infinite loop in IE but not in Firefox

I'm using the following code to override a JavaScript function named dismissRelatedLookupPopup(). In Firefox, this works without a problem (displays the alert once and runs my code), but in Internet Explorer 7 it results in an infinite loop displaying the alert() forever. I'm doing this because I don't control the code where dismissRelat...

Set variable on drop using jquery draggable/droppable

I am working on a proof of concept that makes use of the jquery ui draggable/droppable. I am looking for a way to set a variable equal to the index of a div that is dropped into the droppable area. (Say I have divs named "div0", "div1", "div2", etc...) So imagine the code would look something like this: <div id="div0" class="draggable...

How can I make a wufoo like web app

I want to mimic wufoo form builder web app, I used jquery to drag and drop elements on a workspace, but I need a way to let the user save his finished work , and download his work as html page, can any one help!!! ...

How do you call an ASHX from JavaScript?

I want to call an ASHX file and pass some query string variables from JavaScript and get the return string into a string in the JavaScript. How would I do this? The ASHX file is already coded to response.write a string based on whatever the query strings are. ...

height of an element javascript

I would like to adjust the size of an element in the opposite direction, so the code below does adjust it, but it enlarges it from current position to bottom, I want current position to top. What would be an efficient way of doing this? thanks var ele=document.getElementById('mydiv'); ele.style.height = 500+'px'; ...

Extracting nested function names from a JavaScript function

Given a function, I'm trying to find out the names of the nested functions in it (only one level deep). A simple regex against toString() worked until I started using functions with comments in them. It turns out that some browsers store parts of the raw source while others reconstruct the source from what's compiled; The output of toSt...

Correct element.getElementsByTagName() implementation

//EDIT My issue was related to something else, I thought the implementation was incorrect but it actually works, thanks for the confirmation. Looked in jQuery and prototypejs, can't seem to find the way they implement getElementsByTagName on a element (not document.getElementsByTagName). Here's my test html: <div id="something" style=...

What is the optimal way to replace a series of characters in a string in JavaScript

I am working to improve performance of a function that takes an XML string and replaces certain characters (encoding) before returning the string. The function gets pounded, so it is important to run as quickly as possible. The USUAL case is that none of the characters are present - so I would like to especially optimize for that. As ...

What is the problem with this ajax(with prototype)?

Hello i have the next code: php side: <?php print_r($_POST); print_r($_GET); die(); ?> In javascript: voteAjax = function(typez, actionz, idz){ new Ajax.Request( 'http://localhost/reporeade/Vote/Ajax/?rand='+Math.random()*500000, {asynchronous:true, evalScripts:true, method:'post', par...

Disabling a checkbox in asp.net

I am dynamically creating a CheckBox and setting the disabled property like this: chk.Disabled = false. This renders the following HTML: <input type="checkbox" disabled="disabled" .../> On the click of the checkbox, I have a JS function that tries to enable it by doing a: //get reference to the checkbox chk.disabled = false; Thi...

javascript/jquery leaking and crashing browser

Let me just preface by saying it's actually my crappy code that's leaking and crashing my browser, I just thought I better make the languages being used as clear as I could from the outset. I have a test page here and the javascript can be found here. My problem is that when I try and drag and drop either one of the red pieces more than...

Is JavaScript is a pass-by-reference or pass-by-value language?

The primitive types (Number, String, etc.) are passed by value, but Objects are unknown, because they can be both passed-by-value (in case we consider that a variable holding an object is in fact a reference to the object) and passed-by-reference (when we consider that the variable to the object holds the object itself). Although it does...

Best Practice for Storing JSON Data That Will Be Passed to jQuery Plugin

I'm looking for the "best practice" as to where the JSON should be stored if it's just a string array. Should it be stored in a variable in a script block in the HTML page? Should it be stored in a JavaScript file outside of the HTML for separation? Or should it be stored in the plugin itself? If it should be an external js file, what's...

Possible to make IE7 reload the DOM? Trying to update RSS href url in link tags

I can use this jQuery code to dynamically change the RSS link in the DOM in Firefox & Chrome. http://path.com/feed is normally replaced by a variable, but not for this example. $('#rssfeed').remove(); $('head').append('<link id="rssfeed" rel="alternate" type="application/rss+xml" href="http://path.com/feed"/&gt;'); The live bookmark f...

How do I control repeated Ajax 'post' submissions?

I do not want to stop the user from clicking the same ajax button many times, but I want to exercise some control to prevent someone from maliciously clicking the button repeatedly which would cause repeated database requests. What is simple way to handle this on a jquery .post in asp.net mvc? If I put in a time delay, the experience cli...

Javascript check box validation and length

Have check boxes 1-300. This JS function alerts user when nothing is selected. Function works great for the first 290 elements. For example, when item 291 is selected it alerts that nothing is selected. document.checks.user.length is coming out to 298, not sure why that is either. Any suggestions? Thanks. function sub_delete() //Submit ...