javascript

How to detect if a user had javascript disabled?

I was talking with a friend about users who do not have javascript enabled in their browser and what could be done to show them a "no-javascript" version of your website. Is it possible and how can it be done? Thoughts? ...

YUI getElementById('id').value deprecated??

Hello, My IDE complains the usage of value like in the below YUI statement is deprecated.. it works, still, what is the proper usage. var idValue= document.getElementById('id').value; thanks.. Babu ...

javascript - how to restart a function from inside it?

How do I restart a function calling it from inside the same function? ...

Javascript Reference Outer Object From Inner Object

Okay, I see a few references given for Java, but not javascript ( which hopefully you know is completely different ). So here's the code specific : function Sandbox() { var args = Array.prototype.slice.call(arguments) , callback = args.pop() , modules = (args[0] && typeof args[0] === 'string' ? args : args[0]) ...

How can I organize many results in a selectbox using php?

I have a select box that is part of a form. It is currently querying the addresses table and displaying the addresses into the select box. I plan on having up to 100 addresses. I'm looking for a solution where I can show all the states if the user clicks on the select box. Then if the user hovers over a state it will show all the addres...

Need to set cursor position to the end of a contentEditable div, issue with selection and range objects.

I'm forgetting about cross-browser compatibility for the moment, I just want this to work. What I'm doing is trying to modify a script (and you probably don't need to know this) located at typegreek.com The basic script is found here. Basically what it does is when you type in characters, it converts the character your are typing into gr...

jquery.append() - only the last element of my list is appended, previous ones are erased

Hi, I have a page like this : <div id="daysTable"> <div id="day0" class="day"></div> <div id="day1" class="day"></div> <div id="day2" class="day"></div> <div id="day3" class="day"></div> <div id="day4" class="day"></div> <div id="day5" class="day"></div> <div id="day6" class="day"></div> </div> and some ja...

jQuery: Moving window (or FIFO) type DIV?

I have been trying to get this effect for a couple of hours now and I must admit I am failing at it. I am trying to construct a DIV that accepts a particular number of items (say 5), when the 6th item is added, the first item that was aded should be removed (first-in-first-out). The feel should have some kind of a fadeIn and fadeOut. Her...

How to get z-index to play nice with the jQuery plugin Cycle

Take a look at the bottom right example on the jQuery Cycle Advanced Demos page. Notice how when it loops the gallery, the next image goes beneath the last, as opposed to others where the next image always covers the previous one? Well, at least in Firefox 3.6.3. I'm developing a custom animation with jQuery cycle that has the same pro...

Javascript memory leak/ performance issue?

I just cannot for the life of me figure out this memory leak in Internet Explorer. insertTags simple takes string str and places each word within start and end tags for HTML (usually anchor tags). transliterate is for arabic numbers, and replaces normal numbers 0-9 with a &#..n; XML identity for their arabic counterparts. fragment = d...

How can I get HTML to link to a browser (or system) specified URL?

Hi All, I'd like to be able to create a "HTML link" that the user can click on and be taken to an URL (location) specified either in the browser (preferences?) or system environment. Is this possible? Any suggestions on how to do it please? For example, it may look something like this (or alternatively it could be a clickable image...

PHP javascript link id

<?php //connect to database .... //select query .... if(isset($_GET["link"])==false){ echo "sample 1"; }else{ echo "sample 2" ; } ?> <script type="javascript"> function Link(id) { location.href='linktest.php&link='+id; } </script> <html> <input type="button" value="link test" onclick="javascript: Link<?php echo $row['id']; ?>"> </...

getting the "this" that a function's caller was called with in JavaScript

Is it possible to get the this that a function's caller was called with in JavaScript without passing this to the arguments in a way which supports IE as well as Firefox/Chrome et al? For example: var ob = { callme: function() { doSomething(); } } ob.callme(); function doSomething() { alert(doSomething.caller.this...

Facebook Logout causes logout from my application

I have created simple javascript widget where login happens using Facebook Single Sign On. It logins the person whenever he is logged in to facebook (after authorization for the first time). However, it also logs out the user when Facebook logout happens. I want the person to not get logged out when the person logs out of Facebook? Sugg...

Executing Javascript without a browser?

I am looking into Javascript programming without a browser. I want to run scripts from the Linux or Mac OS X command line, much like we run any other scripting language (ruby, php, perl, python...) $ javascript my_javascript_code.js I looked into spider monkey (Mozilla) and v8 (Google), but both of these appear to be embedded. Is a...

Problem using Javascript to redirect to a URL with a query string

Javascript <script type="text/javascript"> function Edit(id) { if(confirm("Are you sure to edit?")==true) { location.href='employee_set.php&edit='+id; } } </script> PHP <?php if(isset($_GET["edit"])==false) { echo "no response"; } else { echo "link success"; } ?> My problem is the Javascript is OK. The l...

JavaScript get attribution from select

Consider: <select id="test"> <option attribut="1">test 1</option> <option attribut="2">test 2</option> <option attribut="3">test 3</option> <option attribut="4">test 4</option> <option attribut="5">test 5</option> </select> I want to get the selected item's attribute. Is there any simple way to do it? The native JavaScr...

how to get textarea's text using jQuery with newline character preserved?

Hi, I have a text area in which user enters text. I want to retrieve the text as user entered including the new line character which is automatically wrapped. how to get textarea's text using jQuery with newline character preserved? ...

Staging server .htaccess for images, css and js

As we build and demo sites on our staging server with individual root folders for each such as /CLIENTNAME, we need to keep all the css, js and internal links for these sites referencing the server root. The following works for one folder each, but not sure how to adapt to work for all folders. Currently AddHandler php5-script .php R...

jQuery: Access frame in nested frameset

I have a document which has a nested frameset. I need to access one of the nested frames, named "sq_main", and access content inside this frame. Here is my structure: <html> <head> <title>Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <frameset rows="28,*" frameborder="0" border="0"> <frame...