javascript

How can I refactor this JavaScript code to avoid making functions in a loop?

I wrote the following code for a project that I'm working on: var clicky_tracking = [ ['related-searches', 'Related Searches'], ['related-stories', 'Related Stories'], ['more-videos', 'More Videos'], ['web-headlines', 'Publication'] ]; for (var x = 0, length_x = clicky_tracking.length; x < length_x; x++) { links = document.ge...

Connection point Iplemetation in Javascript

Hi All, I need to use activeX control with connection point events in html page.I saw some sodes in different sites and most of tham says use this below code <script for="Cntrl1" event="UploadProgress(Data)"> alert(Data); </script> But This is not working. I got this below code from How to handle an ActiveX event in Javascript (Sta...

Run JavaScript code at ASP.NET page load

I have a radiobox <asp:RadioButtonList CssClass="list" Style="width: 150px" ID="rdo_RSD_ExcerciseRoT" runat="server" Font-Bold="false" RepeatDirection="Horizontal" RepeatLayout="Table" TextAlign="Left" > <asp:ListItem Text="Yes" onclick="en();" Value="Y"></asp:ListItem> <asp:ListItem Text="No" onclick="dis();" Valu...

how can i create a seekbar in javascript

i am working on a webapp for viewing youtube videos using chromeless and it js api i can implement play,pause,mute,etc easily but not sure how to create a seekbar ...

Is jQuery support rich:hotKey feature?

Hi, i have used rich:hotKey for h:inputText in my jsp page. And also i wrote jQuery for get the textBox value. When i use jquery, that time rich:kotKey not worked sample.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> <%@ taglib uri="http://java.sun.com/jsf/html"...

How to detect some Activex in Javascript ?

I have an activex plugin here: http://reboltutorial.com/plugins/logo-badge/ I tried by adapting the script http://forums.devarticles.com/javascript-development-22/detecting-activex-objects-installed-in-ie-11041.html to <script> //if RPluginIE is not installed if( !document.RPluginIE){ document.location.href = "Notfound.html" } </script...

How to "escape" the JavaScript class keyword to specify a CSS class value.

C# allows a reserved word to be used as a property name via the ampersand. e.g. // In ASP.NET MVC, we use @class to define // the css class attribute for some HtmlHelper methods. var htmlObject = new { readonly = "readonly", @class = "ui-state-highlight" } I want to do the same in JavaScript. e.g. function makeGrid(grid, pager) { ...

IE 8 prompts user on "slow" jQuery script

I have a form with over 100 list items that I must reorder on submit. The following code works to reorder my list without any apparent problems in Firefox; however, IE prompts with the message "A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. Do you want to a...

JavaScript: why `null == 0` is false?

I had to write a routine that increments the value of a variable by 1 if it is a number, or assigns 0 to the variable if it is not a number. The variable can be incremented by the expression, or be assigned null. No other write access to the variable is allowed. So, the variable can be in three states: it is 0, a positive integer, or nul...

Test if links are external with jQuery / javascript?

How do I test to see if links are external or internal? Please note: I cannot hard code the local domain. I cannot test for "http". I could just as easily be linking to my own site with an http absolute link. I want to use jQuery / javascript, not css. I suspect the answer lies somewhere in location.href, but the solution evades me. ...

Does anyone get zero-height select fields in Firefox 3.6.3?

If you open this HTML in Firefox 3.6.3 (confirmed in some earlier versions too), and click the drawStuff() link repeatedly, it doesn't render the contents of the last div consistently. Looking more closely it seems like it's rendering select fields with height=0. Any idea why this would happen? <!DOCTYPE html PUBLIC "-//W3C//DTD HTML ...

textarea with bullet point for each line

I have a textarea where users enter notes and want to automatically add a bullet point for each line. I was thinking of using a rich text editor (eg CKEditor) with bulleted mode enabled. Any better ideas? ...

Use javascript to determine if the user is logged into Joomla

Hello, I have a joomla page which updates regularly using AJAX. Depending on other (external) events, the user may get logged out of the site. I would like to be able to tell from Javascript whether the user is (still) logged in. I am looking for some sort of Javascript function which will make a call to the server and will return tr...

Using JQuery to traverse DOM structure, finding a specific <table> element located after HTML 'comment'

I currently have a website source code (no control over the source) which contains certain content that needs to be manipulated. This would be simple on the surface, however there is no unique ID attribute on the tag in question that can uniquely identify it, and therefore allow for further traversal. Here is a snippet of the source co...

Pass object using JSON

Hello All right now i am using Json for passing status and message like return Json(new { Success = true, Message = "Save successfully" }); Project model=new Project() Is there any way, i can send model in json also? I am using c# and asp.net mvc ...

regex breaks on \n

hi segmentText = <input from textarea>; testRgx = [/( \d+\.| [^\W\d_]\.|.)+?([!?.。](?= |$)|$)/g]; arrSegments = segmentText.match(testRgx); This expression fails if segmentText has \n or other white spaces in it.I want to add \n in to the list of chars that the above pattern use [!?.。] => [!?.。\n] so that the segment is separate...

get the right id of a record in database in each click on the edit button

hi every one, i am facing a big problem right now. I have a html table in each row i have a button called edit allowing user to relod the form with parameter that he has selected. for this i define a hidden type to get the id of the record in database to access to various colonne and to refresh the form with those parameters. My challeng...

javascript problems when generating html reports from within java

Hi, I have been working on a Java project in which the reports will be generated in HTML, so I am implementing methods for creating these reports. One important functionality is to be able to have as much info as possible in the tables, but still not clutter too much. In other words the details should be available if the user wishes to ...

JS window.close() let IE hang

Hi all, for reason I won't bore you with, I'm writing an asp.net application that must open some pages in new browser windows. I managed to open them within a postback (don't ask why, I just needed to) with this code: script = String.Format(@"window.open(""{0}"", ""{1}"");", url, target); ScriptManager.RegisterStartupScript(page, type...

Variable width columns in a table

I'm using an HTML table for a calendar and I want to fill the cells with various events from my database. Usually they will land on weekends but some will run for long weekend, bank holidays or even the odd week day. How can I get my tables columns to expand and shrink accordingly. I'd like to avoid the use of javascript if possible. ...