javascript

.innerHTML opera issue?

I'm trying to do : document.getElementById("header-text").innerHTML = "something interesting"; It's working fine with every browser except Opera (I'm running the latest version). Browsing the internet I found people saying that Opera does not support innerHTML. That doesn't sound right. Any pointers? Thanks Edit: Here is the id I'...

Retrieve a cookie from a different path

My current document URL is http: //127.0.0.1/foo and I need to change the value of a cookie for http: //127.0.0.1/bar. document.cookie is empty because document's URL is foo. For the moment, I just want to read the cookie value. Any clue? ...

Delete operation in php using prototype js

I am using php / mysql and protype.js to delete record from a table. problem is that after deleting record from grid, grid is not updating automatically in template. This is my code: Step 1: index.php <?php require("Connection.php"); $sql = "SELECT * from tbluser"; $result=mysql_query($sql); ?> <html> <head> <script sr...

Encrypt part of HTML in PHP and decrypt in JavaScript

Hi, I'm looking for a way to encrypt a HTML form in PHP in a way so I can then decrypt it in the browser using JavaScript. This should work transparently to the user and JavaScript input validation must also work on the form (I know how to do this). When user submits the form, it must be encrypted again and sent to the server using an "...

Equivalent Javascript Functions for Python's urllib.quote() and urllib.unquote()

Hello, Are there any equivalent Javascript functions for Python's urllib.quote() and urllib.unquote()? The closest I've come across are escape(), encodeURI(), and encodeURIComponent() (and their corresponding un-encoding functions), but they don't encode/decode the same set of special characters as far as I can tell. Thanks, Cameron ...

How can I set default homepage in FF and Chrome via javascript?

Hi! I have a code that works only in IE anb I was looking for something similar in FF and Chrome to set user's default homepage through a link 'click here to make this site your default homepage', but so far I didn't find anything. Does anyone know how to do this? Thanks!! ...

Disabling page zoom in IE7 (jQuery/JS)

I know this is not the best thing to do in view of accessibility, but I have a genuine need to disable the user from zooming onto the page using CTRL+ in IE7. I got it working for the other browsers the following way, but IE7 seems to ignore the "return false": $(window).keydown(function (e) { alert('key is down'); // this fire...

How to expand an onchange event with JavaScript

This is a question I ran into about expanding on an element's JavaScript onchange event. I have several select elements that conditionally will have one onchange event attached to each of them (when they change to specific values, it hides/unhides certain elements). I want to conditionally add or append to another onchange event so the...

How do I get Adobe AIR to update an application using JavaScript and the update framework?

This is the basics of what I have: var onError = function() { alert( "error" ); } var appUpdater = new runtime.air.update.ApplicationUpdaterUI(); appUpdater.configurationFile = new air.File( "app:/updateConfig.xml" ); appUpdater.addEventListener( air.ErrorEvent.ERROR, onError ); appUpdater.initialize(); I loaded in all the appropriate...

How can I pass an argument from a web page that is loaded inside a web browser applet in a C# program, back to the C# application?

This is a probably a dumb question but here is what I've got. A web developer has a secure login page that after a user logs into it, a database reference is made and it grants rights to a particular PDF file on our network. There is desire to have a custom locally designed application used to present that PDF file to the user, which i...

Where Is Browser Javascript Stored and Executed?

Hi all, When javascript is run in a browser alert('Hello World'); What environment executes it and manages it in memory? I know this is vaugue! But thats the best place to start! ...

Hook a javascript event to page load

I have an aspx that has the following javascript function being ran during the onload event of the body. <body onload="startClock();"> However, I'm setting the aspx up to use a master page, so the body tag doesn't exist in the aspx anymore. How do I go about registering the startClock function to run when the page is hit and still hav...

rails: accessing an instance variable in a js.erb file

I am trying to access an instance variable from a js.erb file. #controller def get_person @person = Person.find(1) respond_to do |format| format.js{} end end #get_person.js.erb alert('<%= @person.last_name %>') When I browse to [controller_name_here]/get_person.js ... I get a nil object error on @person. (I know Person.find...

Browser back button and dynamic elements

I have a page that uses jQuery to create a number of <input> DOM elements dynamically based on what user picks from a <select> box. Let's say the user picks 4 from the select box, my script dynamically shows 4 input boxes. The problem is when the user refreshes or goes back to this page (with the browser back button). The elements tha...

Javascript getElementById()

Hello everyone. I'm trying to create a generic javascript function that would change attributes on events. The way it would work is function fooFunction(sourceElement) { var newName = sourceElement+'Span'; var newElement = document.getElementById(newName); //Important line newElement.property = "enter properties here";...

Is there any equivalent to dbug (a *really* pretty print for vars) for javascript?

I'm aware of console.log in firebug, and this thing called dbug (but not at all what I want). What I'm looking for is something that will give me a pretty print nested view into an object that looks like this for javascript: I'm also aware of this question, and am looking for something a little more tabular. ...

jQuery UI Sortable -- How can I cancel the click event on an item that's dragged/sorted?

I have a jQuery UI Sortable list. The sortable items also have a click event attached. Is there a way to prevent the click event from firing after I drag an item? <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <head> <script type="text/javascript" src="http://ajax.googleapis...

Start up firefox with session cookie set for a domain

I've tried various permutations of: firefox.exe "javascript:document.location='http://site.com';document.cookies='key=val';" But with no good result; the cookie is not added for the site.com domain. Is it at all possible to accomplish using this approach? ...

Progressive enhancement, behavior when pages are not fully loaded yet

Hi all, I'm developing sites using progressive enhancement implemented completely in jQuery. For instance, I'm adding onclick event handlers dynamically to anchor tags to play linked MP3 files "inline" using SoundManager and popping up Youtube players for Youtube links, through $(document).ready(function()). However, if the user click...

javascript : multple forms with designated fields

This is probably a very basic javscript question but here it goes. say i have 2 forms which are dynamically generated <form name=test1 method=get action=insertaction> <input type=text name=desc value=2> <input type=button onclick="document.test1.submit();" value=submit> </form> <form name=test2 method=get action=insertaction> <inp...