javascript

Javascript floating launch bar

I'm trying to make a just a simple launch bar with a search button that appears in a page when a hotkey is pressed. I'd prefer not having to use a bunch of libraries like mootools or FancyBox(although I'm sure it would make it easier) since this is for a Chrome Extension and I'd like to keep it as small as possible. Any suggestions or s...

Javascript appendChild() call not working in IE

Could someone explain why this piece of script won't work in IE? It seems to work alright in Firefox. I'm new with the appendChild() API. <html> <head> <script type='text/javascript'> function makeTable() { nTable=document.createElement('table'); nTable.setAttribute('id','myTable'); nTable.setAttribute('border','1'); nRow1...

cant query json

Im using jquery to grab some json data, ive stored it in a var called "ajaxResponse". I cant pull data points out of it, im getting ajaxResponse.blah is not defined. typeof is a string. Thought it should be an object. var getData = function (url) { var ajaxResponse = ""; $.ajax({ url: url, type: "post", ...

how do i pass a URL address from a parent to iframe when clicking on something in the parent?

Hi, I have an html page with an iframe in it. The iframe only does 1 thing which holds the longtail video player. Here is the code for the longtail video player (the iframe)... <script type='text/javascript'> var so = new SWFObject('player.swf','mpl','725','415','9'); so.addParam('allowfullscreen','true'); so.addParam('allowscrip...

Showing percentage complete of PHP script

I have a PHP script that takes about 10 minutes to complete. I want to give the user some feedback as to the completion percent and need some ideas on how to do so. My idea is to call the php page with jquery and the $.post command. Is there a way to return information from the PHP script without ending the script? For example, fr...

jQuery - How many cells in a row

Is there a way in jQuery to tell how many cells are in a selected row? For example, I am iterating through the rows via: $("#statsId > table tbody tr").each ( function() { var secondCol = $(this).find('td:nth-child(2)').html(); var thirdCol= $(this).find('td:nth-child(3)').text(); and want to retrieve the second and third cel...

Best way to add missing <p> tags to text in HTML while disregarding other tags?

I'm currently writing a function for parsing some HTML and adding tags where necessary. Basically i have a piece of HTML like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse feugiat, nunc at vestibulum egestas. <script type="c"> #include &lt;stdio.h&gt; #define debug(var) printf(#var &quot; = %d\n&qu...

Determining if a javascript object has a given property

If I want to test of object x has a defined property y regardless of x.y's value, is there a better way that the rather clunky: if ( typeof(x.y) != 'undefined' ) ... ? ...

Write value from prompt box in document

When visitors visit my page, I want them to prompted with a box, ask their name, and use that name in text. I created a script like this: function askname() { var x=prompt("What is your name?",""); } I placed that script between the head tags. Then, I write <body onload="askname()">. The box prompted successfully. Now, I want to use t...

Get the parent element of caret position inside iframe (with designmode on) in IE

This is a follow-up question to the: How do I find out the DOM node at cursor in a browser’s editable content window using Javascript? That was answered by Tim Down. There is a problem getting parent element of caret position (without selecting), inside iframe in IE (in firefox it works great). Here is the partial code from that answe...

Bogus char in Javascript testcase: all breaks

I'm using a JavaScript library called phpjs The goal is to create functions that mimic how PHP handles them. Here's one function in particular: http://phpjs.org/functions/is_float:442 I've written a couple of test-cases and all is as expected. However, all breaks when I try this: document.write(is_float(16.0x00000000)); No true or f...

change background color of current element

Hello, how can I change the background color of current element using plain javascript? for instance <li onmouseover="this.backgroundColor:#000;">something</li> This doesn't work, but you will get the idea what I want to do. Thank you ...

Advice for a new JavaScript developer moving from Flash / ActionScript 3?

I have been moving over to JavaScript (esp. canvas) from Flash / Flex / ActionScript 3 (JavaScript is a more open platform), and I was wondering if anyone has any advice on differences between the two platforms, important things to note, pitfalls, optimizations, etc. ...

Large double quotes: best way to add them

I'm trying to wrap text in some big nice double quotes. I looked at this tutorial, but seems a little more complicated than I thought it should be. My gut tells me someone here in SO knows a smarter way. I'm open to anything: CSS, or PHP or Javascript, or Jquery (but preferably not JS/Jquery) ...

javascript singleton question

I just read a few threads on the discussion of singleton design in javascript. I'm 100% new to the Design Pattern stuff but as I see since a Singleton by definition won't have the need to be instantiated, conceptually if it's not to be instantiated, in my opinion it doesn't have to be treated like conventional objects which are created f...

Change Element Visibility Upon Page Load

Alright, for those of you who have seen the new Google Page, I am attempting to get a similar idea going on my own webpage. Basically, I want the image in the middle to fade in upon a mouse moving on the screen. Here is the URL: http://mageia.rh.rit.edu/ This is the Jquery I am using to get most of the affect: http://hv-designs.co.uk...

javascript code architecture question

I'm about to make a web app which will have a pretty heavy client end. I'm not sure about the way to organize my javascript code, but here is a basic idea : // the namespace for the application var app = {}; // ajax middle layer app.products = { add : function(){ // send ajax request // if response is successful // d...

how can i detect browser with php or js

how can i detect if the user is not using any of (chrome, firefox or ie) browser with js or php ...

able to cause an exception on webportal server after setting webbrowser's javascript to disable

(i am a software tester, not a software developer. i am testing a software developer's webportal (tomcat) / database (mysql) software) In the client webbroswer, I have to have cookies enabled (default) and javascript enabled (default) in order to log-in. I am using FF3.5.5. Once successfully logged in, I then disable the javascript s...

Has Chrome improperly implemented the dataTransfer object?

When I do this in dragstart event: e.dataTransfer.setData('text/plain', 'text'); e.dataTransfer.setData('text/html', 'html'); e.dataTransfer.setData('application/x-bookmark', 'bookmark'); and this in drop event: for (var i = 0; i < e.dataTransfer.types.length; i++) { var type = e.dataTransfer.types[i]; console.log(type + ":" + ...