javascript

Javascript Replace text in string

I'm having some troubles getting regex to replace all occurances of a string within a string. **What to replace:** href="/newsroom **Replace with this:** href="http://intranet/newsroom This isn't working: str.replace(/href="/newsroom/g, 'href="http://intranet/newsroom"'); Any ideas? EDIT My code: str = '<A href="/newsroom/some_...

form change with javascript

I have two drop down lists <select name="branch"> <option value="b">Blacksburg</option> <option value="c">Christiansburg</option> <option value="f">Floyd</option> <option value="m">Meadowbrook</option> </select> but I would like the second list to be different based upon what is selected from the first list. So FREX Blacksburg...

Need Improvement with this script

This script I have found on StackOverflowe only... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; <html> <head> <style> #appear_div { display: none; } </style> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"&gt;&lt;/...

Trying to use stream.puclish in SDK Javascript of facebook but i am completly lost

Hello everybody, I created a game a while ago and I just created an application on facebook linked to my game ( www.tingowar.com ) this game is in french. My idea was to give the oppotunity for the player to put on his wall his upgrades in the game like : you are now level 2, as it would make a wonderful advertising for me. So i searched...

Is there a difference between placing JavaScript calls in $(document).ready(function(){ and placing them in HTML?

Is there a difference, performance or efficiency wise, between placing javascript calls such as blur, onclick etc. in $(document).ready(function(){ as opposed to placing them in HTML? Thanks! ...

HTML where will the focus go next if I press tab?

Hi all, Is there some way of knowing where will the focus jump to when the tab key key will be pressed and certain element has the focus? I am thinking on something to be used this way: var nextElement = whereWillFocusJumpTo(currentElement); Thanks! ...

How do I iterate through table rows and cells in javascript?

If I have an HTML table...say <div id="myTabDiv"> <table name="mytab" id="mytab1"> <tr> <td>col1 Val1</td> <td>col2 Val2</td> </tr> <tr> <td>col1 Val3</td> <td>col2 Val4</td> </tr> </table> </div> How would I iterate through all table rows (assuming the number of rows could change each time I check) and retrie...

toSource in internet explorer

Possible Duplicates: Javascript toSource() method not working Implementing Mozillas toSource() method in Internet Explorer. Is there an alternative method toSource for internet explorer? ...

Javascript funtion to determine if element is in view.

Hello, I need a function similar to the one provided in the "jQuery - Check if element is visible after scroling" question, by "romaintaz". But one that will traverse the element's ancestry and determine if the element can be seen by the user. The problem is that the element in question may be within multiple scrolling divs. Thanks, ...

Returning an integer from a select box - JavaScript

Very simply, I want to be able to access the year from the select box as an integer. In my test, my alertbox is telling me the value is undefined. <form name="form1" method="post" action=""> <label>birth year <select name="birth year" id="dueYear"> <OPTION VALUE='' SELECTED>--Year--</OPTION> <OPTION VALUE...

Can anyone help me with this javascript for validating url in aspx?

Here's my code - function Validate_URL(url) { var iurl = url.value; var v = new RegExp(); v.compile("/^(((ht|f){1}(tp:[/][/]){1})|((www.){1}))[-a-zA-Z0-9@:%_\+.~#?&//=]+$/;"); if (!v.test(iurl.value)) { url.style.backgroundColor = 'yellow'; } return true; } no matter what i put in url...

Javascript Chart to Excel

Hi I'm using highcharts to create some charts (pie, bar, etc...) using just Javascript. These charts do not use Flash or anything like that. Is it possible for me to convert the resulting HTML page with the Javascript chart to an excel document that properly shows the image? I've tried the standard change mime types for excel and so f...

kml click issue

I have two kml files. One contains polygons for counties, and the other pins on the map. I need to show the polygons and on top the points. The pins need to show the pop ups when clicked. When i set it up with first loading the polygons and then the points, the points are not click-able and the pop-ups do not appear. When it set it u...

Is there a unified way to know if a node is visible or not?

Hello guys, I'd like to be able to know if a node is visible and rendered on screen. As far as I know, there are at least 3 standard and easy ways of making HTML nodes not visible: Setting opacity: 0; Setting display: none; Setting visibility: hidden. I could check for just these three, but I'm afraid people can get creative when it...

How Do I Select a `td` Element in a Row That Has a Checkbox That is Checked?

I have a table that looks somethings like this: <table> <tr class="row even"> <td><input type="checkbox" /></td> <td class="name">foo</td> <td class="metric">22</td> </tr> ...etc What I want to do is get an array of all td.metric only in rows that have the checkbox checked. This didn't work out as expected: var ti...

Javascript to change image form submit button src not working.

I'm trying to change the src of an image form submit button using an onclick, but it doesn't seem to be working correctly. Am I missing something? <input class="submit_image" id="my_form_button" onclick="$('my_form_button').src='/images/buttons/submitting.gif'" src="/images/buttons/submit.gif" type="image" /> I've also tried using t...

count the elements in string

I have a string that has comma separated values. How can I count how many elements in the string separated by comma. e.g following string has 4 elements string = "1,2,3,4"; ...

Check if a javascript file is already loaded on a page

How to check in C# if a javascript file is already loaded on to the page? Let's say I have a user control in a different namespace that I load on to a page. I would like to see if a script file doesn't exist before I register it with the scriptmanager. ...

How to stop browser to download "application/json" AJAX response as a file

My firefox downloads the JSON response of an AJAX call as a file. It's suppose to be handled by the JavaScript i.e. JSON object. Can anyone explain how to stop this behavior or there is something I am missing. Thanks. ...

Finding the URL of an XMLHttpRequest

Hi, I've got some code that does an ajax request using jQuery, and handles success and error conditions. On an error, I want to find out what the URL I called was, so I can log it. This information appears to be contained in the XMLHttpRequest.channel, but firefox is complaining about accessing this - Permission denied for <http://loc...