javascript

how to get selected value of dropdownlist using javascript?

how to get selected value from dropdownlist in asp.net using javascript? i have tried the methods below but each of them only return the selected index instead of the value: var as = document.form1.ddlViewBy.value; var e = document.getElementById("ddlViewBy"); var strUser = e.options[e.selectedIndex].value; ...

Can I track an IFRAME widget with Google Analytics?

We are going to launch JS based widgets which webmasters (any site) will be putting on their site by embedding a small code snippet like : <iframe src="SOURCE_PATH" frameborder="0" width="300px" height="150px" scrolling="no" id="cd_frame"></iframe> Inside the widget there are three links and we need to track how many clicks are happe...

how can i debug javascript code within a coldfusion template(a coldfusion page) using visual studio 2008

hi everyone, i know i can debug an asp.net page in visual studio 2008, because visual studio knows asp.net pages. but i'm developing coldfusion based application now, and i'm curious whether i can use visual studio to debug the js code in coldfusion pages. thank you in advance. ...

Getting inner html with jQuery?

I have a javascript/jQuery block as a callback after $.get function: function myCallBack(data, textStatus) { var text1 = $(data).html(); document.write(text1); } The data contains html data ok. I'd like to strip the html and get only inner html into text1 variable. For some reason it doesn't work. Firebug kinda "crashes" upon exec...

setStyle in Prototype doesn't appear to be functioning as intended?

http://i44.tinypic.com/b69h1h.jpg Take a look at the above image, especially the Firebug window. Now have a look here: http://i40.tinypic.com/v2z4up.jpg Has anyone noticed that my JS isn't working? This code was working when I wrote it and let it sit individually, but now that I've integrated it into a site, it appears that the vote ...

String to object in JS

I have a string as string = "firstName:name1, lastName:last1"; now I need one object obj such that obj = {firstName:name1, lastName:last1} How can I do this in JS? ...

How to load a greasmonkey script after AJAX-Request

I have a simple greasemonkeyscript that makes some simple dom manipulation. The greasemonkey script is loaded after the DOM is loaded, that's fine so fare and it does work for the initial Page. But on this site (it's twitter ;-) ) parts of the page get loaded after a click by xmlhttprequest and this part did not get manipulated by my gre...

How to count the number of anchor tags within a div using javascript?

I want to know how to count the number of anchor tags present within a div element. e.g.: <div> <a href="1" >1</a> <a href="2" >2</a> <a href="3" >3</a> <a href="4" >4</a> </div> How many <a> tags? ...

How can I handle numbers bigger than 17-digits in Firefox/IE7?

For a web application I want to be able to handle numbers up to 64 bits in size. During testing, I found that javascript (or the browser as a whole) seems to handle as much as 17 digits. A 64-bit number has a maximum of 20 digits, but after the javascript has handled the number, the least significant 3 digits are rounded and set to 0.......

writing XML files with jQuery

Hey, chaning xml attributes through jquery is easy-peasy, just: $(this).attr('name', 'hello'); but how can I add another tag into the file? I tried using append the JS dies silently. Is there any way to do this? Clarifications: this code is part of an extension to firefox, so don't worry about saving into the user file system. Stil...

Load javascript code after loading code behind

I have a web site released at facebook platform, i am using C# .Net 2008, the problem is that i am loading an array elements from code behind in javascript arary and i am loading elelment element using the following javascript code : ArList = new Array('<%=ListOfWords[0]%>','<%=ListOfWords[1]%>','<%=ListOfWords[2]%>','<%=ListOfWords[2]%...

How to handle localization in JavaScript files?

I want JavaScript code to be separated from views. I got the requirement to implement localization for a simple image button generated by JavaScript: <img src="..." onclick="..." title="Close" /> What's the best technique to localize the title of it? PS: I found a solution by Ayende. This is the right direction. Edit: I got Localiza...

xmlhttprequest onlys gets to status 3

Hello everyone, I have a simple search form with a search box and a result box. When I type a search word a request is created like: http://www.site.com/php_handler.php?s=hello In the php script and a result is given back to the script this way: <?php return $s; ?> The problem is that my htmlrequest stops at readyState 3 it doesn'...

How to manipulate form field values in javascript

I'm trying to get the value of a few checkboxes and enter them in a hidden form field. My checkboxes look like this: <form> <input type="checkbox" name="chicken" id="chicken" value="chicken"/>Chicken <input type="checkbox" name="meat" id="meat" value="meat"/>Meat </form> <form method="post" action=""> <input type="hidden" name=...

Hiding flash component scrollbars using object/param syntax

Hi all, I'm not sure if this is possible (complete non-flash developer speaking), but we have a 3rd party component that we want to only show a certain topleft hand portion of. I've tried limiting the size of the HTML object container as: <object type="application/x-shockwave-flash" width="600" height="415" data="<url>"> <param nam...

Javascript - Get child's text value

How can I get the text value from an elements's child? Say I have this code on a page: <div class='geshitop'> &#91; CODE &#93; &#91; <a href="#" onclick="javascript:copy(); return false;">PLAIN-TEXT</a> &#93; </div> <div class='geshimain'> <pre><div class="text" style="font-family:monospace;">Code goes here...</div></pre> </div> ...

Can javascript access a filesystem?

I was pretty sure the answer was NO, and hence google gears, adobe AIR, etc. If I was right, then how does http://tiddlywiki.com work? It is persistent and written in javascript. It is also just a single HTML file that has no external (serverside) dependencies. WTF? Where/how does it store its state? ...

triggering javascript events using asp.net

I'm writing an asp.net web app. and i've hit a bit of a brick wall. basically i have 2 pages, the main page with a text box in and a popup that contains a treeview. My problem is this. when i select a treeview item i want the program to perform some database transactions using asp.net and then pass the value retrieved from the database i...

JavaScript tree functionality without framework

I'd like to display a tree on a Facebook page with JavaScript. Therefore there can be no dependencies on frameworks such as jQuery or Ext which won't run on Facebook, at least as far as I know when I last worked on that platform (April 2009). Can anybody recommend a "framework-free" JavaScript/tree library? I have ported some fairly c...

How to avoid internet explorer first button selection?

I have one form with several text fields and one button. When i enter one of the text fields, the submit button become highlighted and if i press enter while typing, the button is pressed, so i got an unexpecte behaviour because my page is submitted. Firefox doesn't act such a way. Is there some attribute or configuration to avoid this u...