javascript

Substring arguments best practice

The JavaScript String object has two substring functions substring and substr. substring takes two parameters beginIndex and endIndex. substr also takes two parameters beginIndex and length. It's trivial to convert any range between the two variants but I wonder if there's any significance two how the two normally would be used (in d...

Get value of a query string from asp.net mvc controller action to <script type="text/javascript">

Hi everyone, I am passing a query string with name "RowTobeHighLighted" from my Asp.net mvc action result. What I have to do is, I have to get the query string value from that controller action to a script of type text/javascript. I have tried to use simple Request.Querystring() under javascript. But that is not working. Can anybody ple...

some jquery/js help to change bgcolor on input checked

Okay, I want some jquery/ js to show an yellow background-color when its checked... how to do ? (I use class="valgt" to define which checkbox i want to be styled. <td valign="top" class="valgt"> <input type="checkbox" name="check" value="" /> </td> I have no ideá how to fix it.. so I need some code help for the jquer/ js scr...

How to pass an event object to a function in Javascript?

Hi <button type="button" value="click me" onclick="check_me();" /> function check_me() { //event.preventDefault(); var hello = document.myForm.username.value; var err = ''; if(hello == '' || hello == null) { err = 'User name required'; } if(err != '') { alert(err); $('username').focus(); return false...

Jquery: When Hover on Menu Item, Display Text

Hi, I'm new to JQuery, but wish to use it in a site that I'm building. When the user mouses over an item in the menu with li class hovertriggerssubhead, I want to display some text below it, located in the div (nested inside the li) with id NavSubhead. I have looked at several examples of this, namely in the cookbook in the FAQ of the J...

Asynchronous file upload (AJAX file upload) using jsp and javascript

I am planning on having asynchronous file uploads. That is the file should be uploaded to a jsp or servlet and return something to the html/jsp page without reloading the original page. It should happen like an AJAX call. Is there any way to do it in AJAX or any other way to do it. ...

Image rotation using jQuery but anchor remains the same

I have set up an image slideshow with captions using jQuery. The entire image and caption div is surrounded by a linked anchor. For some reason even though the slideshow function works fine the anchor remains the same as the last one set. i.e. using the example below, the slideshow content will only ever link to "shows/". <div id="mainf...

Command line utility or library to output HTML after JavaScript execution

Is there a command line utility (preferrably for Linux) that can output the resulting HTML after any JavaScript execution? Since many web sites use Javascript to modify the output substantially, it is sometimes not sufficient to use an HTML parser to read data from a web page. A command line utility or library that enables you to see th...

Catch F11 pressed when the flash app is not in focus

hi i have a website which has a video playing. what i want is when my browser going into a full screen mode i want to only show my video. when i press F11 by click on the address bar / click on the browser window and press F11 my browser goes into the full screenmode.But i dont understand that F11 is played. Is there a event from my ...

Stop safari evaluating document.location before saving a bookmarklet (favelet)

Hi I have created a very simple bookmarklet to submit the url of the site currently being viewed to a script: javascript:document.location%20=%20'http://www.example.com/script?user=___&amp;key=___&amp;url='+document.location I serve this as a link on an HTML page that a user can drag up into his or her bookmarks toolbar or wherever. ...

To show Modalpopup in javascript

hi guys, I have a modal popup extender as follows <div id="target" runat="server"></div> <cc1:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID ="Modal" runat="server" TargetControlID="target" BackgroundCssClass="modalBackground" PopupControlID="Panel1"></cc1:ModalPopupExtender> <asp:Panel ID="Panel1...

Is there an equivalent Javascript or Jquery sleep function ?

Hi. I want something like this in javascript. for (i = 0; i < 10; i++) { alert(i); // now sleep 1 sec sleep(1000); } is there a built in Javascript or Jquery for this? Thank you! ...

Returning a stream directly to the web browser

I am generating a file on the server and I do not want to write it to disk but instead return it to the client via a web service. What recommendations would you have to do this? ...

Shadowbox doesn't seem to work

Hi I have an XHTML 1.0 Strict document in which I'm trying to make Shadowbox work. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta name="Content-Type" content="text/html; charset=UTF-8...

Blur Event Does not get Fired in IE7 and IE6

I have a dropdown Menu where in a div is clicked and List is shown. On focus out I am supposed to hide the list(i.e. when the user clicks or focuses on some other element and not on mouse out) Hence my obvious choice was 'onblur' . Now the javascript seems to work in firefox but not in IE thats because my div has a sub div with a hei...

Remove child not working

Hai I am doing a web page. In that there is a drop down contains some products, when we select an item it will display below with a remove button as dynamically. My problem is that al the products removed correctly but a product that has product id 5 is not removed? What's the problem? Below is my code <script type="text/javascript> fu...

Concerned with datalist

hi guys, I have a datalist.My designer code is like this. <asp:DataList ID="dlView" runat="server" CssClass="basix" RepeatColumns="4" > <ItemTemplate> <tr> <td> <asp:Image ID="imgPlan" runat="server" ImageUrl='<%#GetImage(Eval("ImageName")) %>' /> </td> <td> <asp:LinkButton ID="lnkChangeLogo" runat="server" Text="ChangeLogo"...

Regex for matching spaces not preceded by commas

I need to convert a string like this: tag, tag2, longer tag, tag3 to: tag, tag2, longer-tag, tag3 To make this short, I need to replace spaces not preceded by commas with hyphens, and I need to do this in Javascript. ...

Finding the next input (of a parent?) with jQuery

Hi guys, I've got a checkbox inside a table, and when you click on it, it'll change the background colour accordingly like so... $("#table tr td :checkbox").bind("click change", function() { $this = $(this); // cache the jquery object if($this.is(':checked')) { $this.closest('tr').css('background-color', 'lightyellow'); } e...

ASP.Net AJAX - Any end-to-end examples of writing a WebControl?

I'm trying to write an AJAX enabled WebControl. This is my first AJAX control and apart from the usual use of UpdatePanels and ScriptManagers, I've not got a lot of experience in the other angles and use of AJAX. I've found a number of examples and projects that claim to be AJAX enabled control's, although they all seem to be missing th...