javascript

Web crawler that can interpret javascript

Hi, I want to write a web crawler that can interpret JavaScript. Basically its a program in Java or PHP that takes a URL as input and outputs the DOM tree which is similar to the output in Firebug HTML window. The best example is Kayak.com where you can not see the resulting DOM displayed on the browser when you 'view source' but can sav...

Tiny MCE - set full-screen when editor is loaded?

I use tiny_mce as word-like editor in textareas that are in iframes. I want to use whole iframe space. TinyMCE has a fullscreen button, but I need to set full-screen mode automatically when plugin has loaded. Is there a function/trigger to call this mode (or the button)? Thanks for help. ...

How do I insert an input's value into a separate form?

I'm making a tool for my university that allows students to create a list of classes by doing the following: Searching by course title for their course via an autocomplete input field. Adding that course to a separate form that upon being submitted creates a course list. I am trying to link the autocomplete and the course list form w...

is there a way to hold the values? - lost in postback

i have two select using as a dropdownlist for country/state everything works as i expected but when i do a postback then i lost the values from the above <select...> what is the best way to retain the values and can you show me with an example please? <asp: Button ID="Button1" runat="server" onclick="Button1_Click" Text="PostBack" /...

Debugging JavaScript in Internet Explorer

I am working on a relatively complex JavaScript-driven website. It runs great in all browsers except Internet Explorer (7, this particular version is our corporate standard). I am getting this very curious error: "A Runtime Error has occurred. Do you wish to Debug? Line: 93,865,600. Error: Expected ';'" The issue is, I don't have ...

Use jQuery to find div by background color

I'm trying to use jQuery to find the number of divs that are both visible, and have a background color of Green. (Normally I'd just add a class to the div, style it green, and check for that class in jQuery but in this instance, I can't actually change the markup of the page itself in any way) I currently have the visible div part work...

Looping through Markers with Google Maps API v3 Problem

I'm not sure why this isn't working. I don't have any errors, but what happens is, no matter what marker I click on, it always clicks the last marker. Im not sure why though because the_marker is set up the same way. How can I fix this?: (Updated with new jQuery + XML) $(function(){ var latlng = new google.maps.LatLng(45.522015,-12...

JQuery - nested ul/li list, keep expanded after reload of page

Hi, I have a nested ul/li list <ul> <li>first</li> <li>second <ul> <li>Third</li> </ul> </li> ... and so on I found this JQuery on the interweb to use as inspiration, but how to keep the one item i expanded open after the page has reloaded? <script type="text/javascript"> $(document).ready(function() { $('div#side...

Does margin-left:2px; render faster than margin:0 0 0 2px;?

Douglas Crockford describes the consequence of Javascript inquiring a node's style. How simply asking for the margin of a div causes the browser to 'reflow' the div in the browser's rendering engine four times. So that made me wonder, during the initial rendering of a page (or in Crockford's jargon a "web scroll") is it faster to write...

Can't empty JS array....

Yes, I am having issues with this very basic (or so it seems) thing. I am pretty new to JS and still trying to get my head around it, but I am pretty familiar with PHP and have never experienced anything like this. I just can not empty this damn array, and stuff keeps getting added to the end every time i run this. I have no idea why, ...

Get url from iframe and update hash in browser url

I've tried a few different things but nothing really worked, basically i need to get the current location/url from the iframe, get the part i want and return it to the hash in the url. how can i do this in javascript? ...

Displaying decimal degrees..

I have a Web Application that displays a Map Service that is in NAD 1927 UTM Zone 15N. I have JavaScript code that displays the XY in status bar based on where mouse cursor is on that map. I want to display Latitude/Longitude values instead. Does anyone know how? ...

Accessing class variable with string name?

I have a class like this $.fn.dimeBar = function(custom) { var var1 = 'test1'; var var2 = 'test2'; if(sometest){ //how can i access var1 or var2 here by using string name of variables //some thing like alert(this['var1']) --> should alert: 'test1' } } ...

Advanced Form Validation in JavaScript

I'm already familiar with how to use onSubmit to evaluate form content against RegEx to ensure it meets static parameters for acceptable content. What I'm wondering is if there is a way to further provide validation against a MySQL database, such as if you want to make sure an e-mail address hasn't been used yet before submitting a form...

Most efficient way to create and nest divs with appendChild using *plain* javascript (no libraries)

Is there a more efficient way to write the following appendChild / nesting code? var sasDom, sasDomHider; var d = document; var docBody = d.getElementsByTagName("body")[0]; var newNode = d.createElement('span'); var secondNode = d.createElement('span'); // Hider dom newNode.setAttribute("id", "sasHider"); docBody.appendChild(newNode); ...

jquery next() outside of div

Hi, I'm trying to use next() to toggle a div. The problem is that the "trigger" is in a different div than the one I want to toggle. An example that works: $("span.trigger").click(function(){ $(this).next("div.task_description").slideToggle("fast"); }); <span class="trigger">The trigger</span> <div class="task_description "> ...

Problem with making a simple JS XmlHttpRequest call

Edit: Maybe I made the question more complex than it should. My questions is this: How do you make API calls to a server from JS. I have to create a very simple client that makes GET and POST calls to our server and parses the returned XML. I am writing this in JavaScript, problem is I don't know how to program in JS (started to look in...

Iterating changes using jQuery?

In the HTML below, I would like to copy the "submittedby" beside "message", within the H2 tag: <div class="comment"> <H2 class="threadtitle">Message 1</h2> <span class="submittedby">James</a> </div> <div class="comment"> <H2 class="threadtitle">Message 2</h2> <span class="submittedby">Bill</a> </div> <div class="comment"> <H2 class="t...

parsing css measures

When i write a jQuery plugin i like to specify options for spacings the CSS way. I wrote a function that returns a CSS String as values in a object. 5px 10px returns top: 5px, right: 10px, bottom: 5px, left: 10px Now i often use the returned values to do some calculations and its not very nice to have to extract the measuring unit eve...

Range Selection and Mozilla

I would like to specify that firefox select a range. I can do this easily with IE, using range.select();. It appears that FFX expects a dom element instead. Am I mistaken, or is there a better way to go about this? I start by getting the text selection, converting it to a range (I think?) and saving the text selection. This is where I'm...