javascript

Get relative path to image

I wrote a javascript method to display an image dynamically depending on whether or not a plugin is installed or not. Depending on the page, the url might be deep into sub paths and i wanted to see if i can get a path back to the image without all the marky-mark. Example myImage src location = {root}/Content/Images/myImage.png Now cal...

How do you access the text in a <caption> tag?

I have my HTML like this: <table> <caption class="my_caption">Table 1.1: TABLE CAPTION</caption> <tr>...</tr> <tr>...</tr> ... I need to get the caption text so I can make some string comparison. I've tried doing .val(), .text(), .html() and .value but none of them work. Thanks for your help. EDIT: I actually have a few of those...

Resolving difficult to recreate bugs

In a js app I'm developing there are a few bugs that recur every now and then for some users who are testing it, but I've been unable to recreate them myself. What tools/approaches are there to debug bugs which are difficult to recreate, or which only seem to happen on a computer the developer doesn't have access to? ...

Full window onClick handler in Firefox and Internet Explorer

I would like an event handler to fire whenever someone clicks anywhere on a window (so I can clear away a menu if they click someplace other than the menu). The following works in Safari: function checkwho(ev) { obj=(window.external) ? event.srcElement : ev.target; var type=obj.nodeName; if ((type == 'BODY') || (typ...

Javascript anchor navigation

I am creating a website with the "anchor navigation" like used with facebook and google mail. I have got it working but not fully. When I load the page with something like #contact it won't load it in unless I click the link for it. Also, would there be a better, more efficient way to do what I am doing? I am not the best person with JS ...

Using MVC to implement a framework in JavaScript

Hi, I'm doing .NET MVC a lot so I think I understand the MVC design pattern. I'm analyzing my projects according to the Domain Driven Design (Eric Evans) methodology. Anyways.. But in JavaScript it's hard for me to think "MVC" when I'm creating libraries. Do you have a small example or any experience to share with me on how a small Ja...

Webkit threading javascript file loadsand execution order

I am trying to building a XSS widget and am having issues with Webkit browsers loading the external javascript files which I am appending into the dom. It works as below: Widget.js appends 3 javascript files into the dom (jquery, data, content) Jquery.js is standard jquery with a custom namespace Data.js is a javascript array Content.j...

How to play a audio sound in a web page as a background music

I want to play an audio file whenever my page gets loaded onto the client browser. And if a user presses a pause button on the web page then the sound gets paused until he leaves the sound and can resume as well. ? ...

DOM to use with SpiderMonkey?

I'm trying to use the GoogleMaps javascript library from inside of SpiderMonkey using the pythong wrapper, but I can't because of the lack of a DOM. Is there some way I can integrate a DOM into this so that I can get this to work? ...

Change hyperlinks dynamically using jquery

Hi, I want to change the param of link dynamically. For e.g. Link1 Link2 Link3 by default their url is ?item=text i.e. for link1(href="?item=link1") etc.. but when i click link1 the url of link2 and link3 should be link2(?item=link2&item=link1) link3(?item=link3&item=link1) any idea how to acheive this? Thanks, ...

Handling unknown number of values in PHP file

The form that will be submitting the data will have somewhere between 10 and 100 values being sent to the PHP file. The number of inputs is stored in a variable called count within my javascript function but I don't know how to transfer its value to my PHP file. Another idea I had was to have a while loop that detected a null value and...

Unable to Hide Vertical Scroll Bar on Web Page

I am displaying an HTML page within another HTML page depending on which link is selected using the following function: function loadProject(sel) { var url = sel[sel.selectedIndex].value; if(url) { document.getElementById('projectContainer').innerHTML = '<' + 'object id="foo" name="foo" type="text/html" data="'+url+'"><...

How can I set a variable in my pages javascript based on my controller action in ASP.NET MVC?

So, I have a page that looks like the following: This is my basic messaging inbox. I have 2 pages right now, Inbox and Sent (there will eventually be others). These both share the same View, and just have 2 different actions to populate the appropriate data. The elements on the right-hand side (the message list) is a partial view wh...

Web Application Architecture (ASP.NET 3.5,JavaScript)

hey all , background - I'm using an activx that allow me to access some information on the client side, By using the activex events and callback i'm updating server side from client. i wrote a user control that register all activex's events so when one of the events occuer there is a callback to the server that handle this event. I ...

How to remove an individual text node in a div without removing all of them?

How do I go about removing an individual dynamically created text node? I am generating input's on the fly and am using .createTextNode to place descriptive text before the elements. I need the ability to delete specific elements that are being created and am using .removeChild to do it. That works fine for removing an individual inp...

javascript persistent selection

I need to only have 1 character at any time in an input field. The only way I can think of doing this is by having javascript keep everything in the box always selected and making the maximum input length 1 so that when I type something new, whatever was in there gets overwritten (since it is selected). That way I don't have to use backs...

xmlHttp string POST Headers issue

i am trying to pass a string through the XmlHttp method. Let me show you the code: HTML <div id="greetings"> You are voting out <b style="color: #00b0de;" id=roadiename></b>. Care to explain why?<br/><br/> <textarea name="textarea" id="comment" cols="38" rows="7"></textarea><br> <a href="#" id="postmsg" onclick=...

Is there a way to return a list of all the image file names in a folder using only Javascript?

I have a dropbox account. I put a bunch of images in a public folder. I'd like to display the images using shadowbox. Right now, I'm manually entering the filenames into this html file. Is there a way to dynamically update the gallery when I drag new images into the images folder? I'd prefer javascript if it's possible. If it's not...

Does JavaScript get excuted when partial view is loaded?

Background I'm working with ASP.NET MVC. I've got a partial view which contains JavaScript. I'm using AJAX get to load the partial view into a <div> tag. The JavaScript registers a click event for a group of radio buttons. Problem It doesn't seem to be executing: when the radio buttons are clicked, the form doesn't get submitted....

evalScripts:true does nothing with Ajax inplace editor

I have the following code to create an inplace editor: new Ajax.InPlaceEditor('artifact_pretty_display_date_110_in_place_editor', '/artifacts/set_artifact_pretty_display_date/110', {evalScripts:true}) The response looks good to after I change a date: Element.update("artifact_pretty_display_date_110_in_place_editor", "12/06/2008"); El...