javascript

ASP.NET ScriptService JavaScript alias

Hi, This is more a cosmetic issue, rather than an actual "problem". I've got a solution in which I am converting a lot of PageMethods into WebService calls instead. Some of the PageMethods created a page overhead of several hundred kilobytes, so I thought I'd extract them into their own WebServices, thus reducing the page overhead and e...

how to trigger button onmouseup handler from javascript

how to trigger onmouseup handler from javascript i have my button <input id="x" onmouseup="doStuff()"> and i want to trigger document.getElementById("x").onmouseup();????? ...

Associative arrays in javascript to JSON

I am using array as an associative array of objects in which keys are ID number of objects in database. Quiet naturally- IDs are large numbers - so that means it is common to have array of length 10^4 with only 20 elements as valid real objects. I want to send this data back to server but whatever plugins I had to convert js objects to...

Simile Timeline - Floating Dates

We are trying to integrate the Simile Timeline (http://www.simile-widgets.org/timeline/) into a SalesForce.com powered page. The business is, apartment bookings. The calendar will display the bookings against the related apartments. The apartments appear on a separate div on the left hand side and is fixed. We may run into really long...

Automatically reposition Jquery SimpleModal to center of page when modal div is resized

I'm using the SimpleModal Jquery plugin and it works great! However, there are times that the width and height of the modal div need to be changed, so I need the modal to automatically re-position itself in the center of the page. I found out that SimpleModal uses its setPosition() function to do this. It is automatically called when th...

JavaScript rejects all my RegExs, how come?

Hi, I have this at the moment, (I found the code on here). var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig; someText.replace(exp, "<a href='$1'>$1</a>"); It will replace any http://URL in someText with a proper <a href> But i also require it to match www. without the http. I found ...

Check username availability on fly?

Hello, I want some javascript + ajax to check username availability on fly. And I have some troubles... Let's imagine the situation when we're checking username availability on blur event. What if we're getting such scenario... a) user entered username "kir" b) focuses on another element c) ajax request started (requesting availabi...

How to get the type of an element. JavaScript / jQuery

Right, idiot moment coming up. I've done a search, but can't find the right solution. I've got a jQuery selector selecting a class, maybe an ID, in fact it could be anything, this selector is fed into a function I'm programming. I need to be able to figure out the type of each matched element, for example: <div class="target"></div> ...

getElementsByTagName gives us the same result for IE and Firefox

We are using the getElementsByTagName function to find out domnodes present in the article. We found that IE and Firefox give different result for broken tag as below. e.g. <a href="http://www.yahoo.com"&gt;Bypass HTML tags</ a> &nbsp; Complte 2 Fails In IE : for above example we will get two nodes 'A' and '/'. In firefox for above...

Javascript does not execute Object methods

I'm trying to build some objects to make my life a bit easier, but somehow I can't get it working. I got the following code: function Paragraph(className, innerHTML, parentId) { this.className = className; this.innerHTML = innerHTML; this.parentId = parentId; } Paragraph.generateParagraph = function() { console.debug(...

stop scrolling on bookmark hyperlink clickin

Hi guys, I am trying to make a jquery similar tabs. since its for single use in single page i dun want to use jquery so i am making my custom function. I have my li tags as following <li class="active"><a href="#tabs-0" onclick="showTabs(this); void(0);" class="active">Description</a></li> My function gets fired and is working fine....

Call a javaScript function with arguments in jQuery

I have a javascript function with arguments that I want to call in jQuery and I am stuck. I tried this : $("a").click(highlight(arg)) but it doesnt work. Any ideas ? Johanna ...

Select all elements between two p-elements.

I'm looking for a nice way to mark/select all elements between two selected elements. Imagine <parent> <p>...</p> <p>...</p> <p>...</p> <p>...</p> </parent> There's a click handler on parent. The user now can select two p element in this list an then all p-elements in between should get 'activated'. I'm thinking about a sy...

Javascript/jQuery - Use modulus to ensure height of div is a multiple of x

Hello, I've got a blog with lots of div.contents, each of which I'd like to have a height as a multiple of 22px (so all the text lines up with a background image of a grid). I'm imagining you'd probably do something like: // loop for each div.content // var height = $('div.content').height() // var modulus = height%22 ...

Is it possible to get the min and max value with jQuery and render it in another input-field?

Hello, and there we go: I'm writing(in fact it feels more like trying and asking) a GreaseMonkey script using JS and including(also using) the jQuery library. I created another table with some input-fields. Example(input-fields-only): + " < input type=\" text\" id=\" field_1\" name=\" min_field_1\" value=\"\" > " + " < in...

Detect decimal (dot) key from numeric keypad

I need to detect whether the user has pressed the dot key in the numeric keypad. I've written this first draft that works for me: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head><title></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/...

Javascript replace method, replace with "$1"

I'm reading Sitepoints 2007 book "Simply Javascript" and I encountered some code I just can't understand. It's the following code: Core.removeClass = function(target, theClass) { var pattern = new RegExp("(^| )" + theClass + "( |$)"); target.className = target.className.replace(pattern, "$1"); target.className = target.clas...

Why parrents tabsshow-event triggerd by childtab?

I have a tab (called firsttab) with in his content another tab (called childtab). We bind the tabshow-event to the firsttab. if we click to one of the tabs in "firsttab" all work fine (Tab 1 - Tab 5) if we click to one of the "childtab" tabs (Tab 1.1 - Tab 1.3) the tabshow-event who are bind to the "firsttab" is triggerd. Testcase: ht...

Arrange in list ?

hi i have code function mywidgets(){ alert(id1); alert("ABC"+" "+url1); var ni = document.getElementById('Listsample'); var numi = document.getElementById('cr'); var newdiv = document.createElement('li'); newdiv.innerHTML = "<a href='#' onclick='add("+url1+");' id='cricket' name='cricket'>"+id1+"</a>"; ni.appendChild(...

html codes from external html-file in to textarea (any professional in active-x or javascript help me)

In the below code how can i make it load the file into a textarea where textarea path is parent.a.frame_name1.document.form_name1.textarea_name1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv=...