javascript

How to config IE to make "wscript.shell" work.

I have some code that used to work. But I today when I try it again. I kept got "[object error]". I thought it's the problem of IE safety configure. But I can find how to config IE to make it work. function Run() { try { var objShell = new ActiveXObject("wscript.shell"); objShell.Run("calc"); } ca...

javascript, php, cookies

the application returns a value "1" in the database instead of the mac address... I'm able to document.write the output of the mac address, but not able to have it store in the database. Is the program using the previous cookie? (but Ive deleted all the cookies from the pc) but if i change the variable mac to string data, it keep ref...

global variable in javascript?

i have this code: $(".link").each(function() { group += 1; text += 1; var links = []; links[group] = []; links[group][text] = $(this).val(); } }); var jsonLinks = $.toJSON(links); after it has looped every .link it will exit the each loop and encode the ...

Dynamically changing DOM-elements as they get's scrolled into view (performance)

I'm trying to find an efficient algorithm for dynamically loading background-images for a bunch of <li>'s, and are having some efficiency problems. My current code looks like this: function elementInView($elem, vps, vpe) { var elempos = $elem.position(); var pagestart = elempos.top + vps; var pageend = elempos.top + vps + $...

how do i delete cookies

how do i delete a cookies using javascript?? can i have it run whenever my browser start?? or can i specific what cookie file to delete? ...

How to capture the onload event of a window with attachment response?

Hi, I have the following download request in javascript: var exportWindow = window.open('Download.ashx?source=1', ''); exportWindow.onload = function() { alert('finished'); }; My problem is that the above alert box does not appear. The download.ashx sets up the following response (which will be saved as a csv file), which works f...

Dynamic Iframe IE Name Issue

Hey Guys, This seems to be a common issue, and the solutions which I have seen do not seem to be working for me. We've got a dynamically generated and inserted iframe, with a form which submits to it. Works fine in FF and IE8, but in 7 we are getting the iframe name issue (IE does not want to set iframe name using element.name or eleme...

jquery image slideshow with links per image

i'm in search of a simple jquery image flipper/fader, that will cycle through a bunch of images, each of them with it's own link. the flipper will be used like so: my client wants to display logos of his own clients in succession where each logo will link to the respective website. i know this can be implemented in flash, but i (and my...

send array to php from javascript?

i want to send a javascript array to php using jquery ajax. $.post("controllers/ajaxcalls/users.php", { links: links }); where the second 'links' is a javascript array. when i've got this array: '1' ... '1' => "comment1" '2' => "link1" '3' => "link2" '4' => "link3" '2' ... '1' => "comment2" '2' => "link4"...

Script causes IE6 to fallover with no error

I hate IE6, in fact I wish microsoft would force out a patch that killed the damn thing stone dead. The following script works fine in IE > 6 & FF,WebKit(chrome etal) without issue; any ideas? (function getElementsByClass(searchClass) { node = document; tag = '*'; var els = node.getElementsByTagName(tag); ...

JQGrid tree - passing additional parameters when tree is expanded

I have a JQGRid tree. It loads data click by click, not all at once. Typically, JQGRid passes 4 standard tree parameters with each call - row (level, parent, is leaf, is expanded). How can I pass more parameters that I will take from the row being expanded? E.g. data from Name column should be passed in AJAX call too. There doesn't seem...

How to get row index of a gridview row clicked by a user on it by javascript ?

How to get row index of a gridview row clicked by a user on it by javascript ? ...

rewrite urls in a firefox addon

Hi, I'm writing a firefox addon, and if certain conditions are met, id like to rewrite the URL. Right now its being done in the following fashion if(checkUrl(document.location.href)) { document.location.replace('xyz.com'); } the problem with this is that the old page loads, then the condition is met, and only then is the user redi...

javascript array to php

i want to send a javascript array to php using jquery ajax. $.post("controllers/ajaxcalls/users.php", { links: links }); where the second 'links' is a javascript array. when i've got this array: '1' ... '1' => "comment1" '2' => "link1" '3' => "link2" '4' => "link3" '2' ... '1' => "comment2" '2' => "link4"...

Help to scroll thumbs horizontally using a slider as the control

Hi I am generating a thumb gallery (4 pics horizontally by 2) from an excel file's contents (it has the picture names etc, needed to generate it), and I want to scroll the gallery horizontally using an ajax slider control - adding to the thumbs on the right and taking thumbs from the left so that only 4 to 6 (horizontally) are actuall...

Post serialized form data and extra variables using JQuery

I am trying to use this piece of code to serialize a form AND send an extra variable not found in the form, at the same time. The following line of code is what I expected, but sadly does not work. var thePage = theFilename(); $.post("pagedetail.php", { $("#PageDetailForm").serialize(), thePage: thePage }, function(data) { a...

Different approaches for File upload using Ajax

To upload the file using JavaScript generally iFrame approach is used in which Hidden iframe is maintained and then the file is uploaded using the iframe. However it is said not to be reliable method for the file upload and Flash is used for this purpose. So i am not clear how this is done? I mean by Flash and JavaScript together ? ...

URL fragment identifier - simplify state handling (javascript)

I have a web application which makes extensive use of the fragment identifier for handling "state". examplesite.com/#$mode=direct$aa;map=t;time=2003;vid=4;vid=7 A number of questions: 1) What is a good way of assigning the various "location.hash name value-pairs" to variables to keep track of the state? 1a) Should I make an object t...

window.getSelection() gives me the selected text, but i want the html

I'm extending a WYSIWYG htmleditor (for firefox), I want to add tags around a selection. I can't find a function to accomplish this in the Mozilla Midas specification. There is a command to replace the selection with html. So if i could read the selection contents, i could add my tags to this string. window.getSelection() almost works...

Getting 'href' value of an anchor inside another element

Suppose I have this: <ul id="menu"> <li><a href="someplace">some text</a><li> ... </ul> I want to make every li clickable so I need to extract the value of href like this: $('#menu li').click(function() { var link_to = $(SELECTOR THAT I NEED).attr('href'); window.location = link_to; }); what's the correct code for this? Is ...