javascript

How do I use a link instead of the browse button to attach a file?

I have a form like the following: <form id="submit_idea" name="submit_idea" method="post" action=""> <a class="attach" title="Attach a file" onclick="clickAttachment()" href="javascript:void(0)">Attach File</a> <span id="id_filename"/> <input id="id_attachment" type="file" name="attachment"/> <input class="submit_btn" type=...

Best Way to automatically compress and minimize JavaScript files in an ASP.NET MVC app

So I have an ASP.NET MVC app that references a number of javascript files in various places (in the site master and additional references in several views as well). I'd like to know if there is an automated way, and if so what is the recommended approach, for compressing and minimizing such references into a single .js file where poss...

Returning a byte array from activex to javascript

Hello all, I've built a small activex control using c#. I've got a function that returns an array of bytes. From some reason when I try to consue the returned array in js I receive an undefined value. Why is this happenning? Is there anyway to solve it? Here's a simple demonstration of my code: Activex: [ComVisible(true)] public...

Uploadify won't upload files to my php script!

I'm trying to get uploadify to send it's files to a php script but it comes back blank every time... i'm totally confused as sometimes it won't even attempt to upload the files. Form: <form action="upload.php?1" method="post" id="uploadForm" enctype="multipart/form-data"> <input type='file' name='uploadBox' id='uploadBox' /><br/> <inpu...

open custom Site Actions link in a new window (SharePoint)

When using custom actions in SharePoint (for the Site Actions menu) how can I make it so that the links will open up in a new window? I have tried an approach using jQuery that would attach a hover event via .live() to replace the window.location with a window.open call -- however this proved to be troublesome as it refused to work in I...

How can I disable highlighting in html or JS?

I need to disable highlighting on my web app. I have a good reason for doing this and know that this is generally a bad idea. But I need to do it anyway. It doesn't matter if I need to use CSS or JS to do it. What I'm mainly going for is the removal of the blue color given to highlighted elements. ...

unable to get jquery clone to work correctly

This is the js code that i have currently <script src="jquery.js type="text/javascript"></script> <script type="text/javascript"> $('input.clone').live('click', function(){ //put jquery this context into a var var $btn = $(this); //use .closest() to navigate from the buttno to the closest row and clone it var $clonedRow = $b...

is there any way to call a function periodically in javascipt

Is there any way to call a function periodically in JavaScript. ...

Ordering javascript code on a page executed with argument calculated in codebehind in ASP.NET

A situation requires me to order javascript code on a page be executed with an argument calculated in codebehind in ASP.NET Here is the situation: I have a page called search.aspx . This page contains a button and a textbox. Users put their arguments for search in the textbox and then click the button. The button posts back and runs a ...

XHTML DOM manipulation with jQuery

I'm using Firefox 3.5. My doctype is XHTML 1.0 Strict. Let's say I want to insert an image into a div with id "foo"; then I might try: var foo = $('#foo'); foo.html('<img src="bar.gif" />'); This does indeed add the image. But I noticed that this was causing some odd behavior later in the document, which I suspected might be due to XH...

Problem running my project in IE 6.0 and 7.0

I am using AJAX for my project. And the entire porject is working fine on all browsers except for internet explorer 6.0 and 7.0 too It is working fine on IE 8.0. Anyone has a suggestion, what i should be doing?? Regards Zeeshan ...

Hidden Input Elements in Firefox

I'm having troubles with fckeditor in Firefox. When the user goes to a page, the html (encoded) is stored in a hidden input element. I call the predefined fckeditor javascript event to populate my editor with the html from the hidden ContentBody element. function FCKeditor_OnComplete( editorInstance ) { edi...

Conditionally setting a javascript function after posting of a form

Apologies for the very basic question - crash course in javascript coming up! But before that, I have a javascript function: function toggle(request) The function simply toggles a div as visible/invisible. I can trigger the behaviour I want from this function using an onclick event as follows: <input type="radio" name="complete" val...

Ajax with PHP and XML, getElementsByTagName IE issue

I'm having an issue with getElementsByTagName in IE (7 and 8). I have an address lookup that returns each suggested address (as a string of XML) into a PHP session variable, which is then accessed using an AJAX function that returns the requested session variable. Each session variable is set in step 1 of the ajax address lookup (I ha...

What is the advantage of using unescape on document.write to load javacript?

The code that you have to add to track a web page with google analytics looks like: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </s...

adjust Gridview Width

I have a Gridview that uses a collapsible panel to show a large amount of text. When the button is clicked to display the text my edit and delete button align on top of eachother as opposed to being side to side so I need to adjust the width of the Gridview in javascript. I already have the label calling a javascript function onclick but...

How do I programmatically change a select so that it fires its onchange behavior?

This doesn't seem to be working: <select id="mySel" onchange="alert('foo')"> <option value="a">a</option> <option value="b">b</option> </select> <script> dojo.byId('mySel').value = 'b'; // select changes, but nothing is alerted </script> (I'm using dojo, but that doesn't really matter.) ...

Javascript serialization of DateTime in asp.net is not giving a javascript date object?

When I parse a DateTime to json in .Net it returns a string (i.e. "\/Date(1249335194272)\/"). How do I make it return a js Date object constructor not wrap in a string? // js server code var dteNow = <%= jsonDateNow %>; // js rendered code var dteNow = "\/Date(1249335477787)\/"; // C# using System; using System.Collections.Generic; ...

How to stop an MVC RedirectToRouteResult JavaScript?

I am designing a site and am trying to be compatible with javascript turned off or on. I have a Controller Action named as follows... public RedirectToRouteResult AddWorkAssignment(int id) { // delegate the work to add the work assignment... return RedirectToAction("Index", "Assignment"); } and my jQuery I do a post $('#som...

How can I streamline/improve/beautify my auto-form JS code?

I've got a Javascript (dojo) function that I'm using to auto-populate a form. The idea is to pass in a JS object with keys for the form field ids, and values that help define how to fill in the field. It works, but it feels a bit ugly to me (the switch statement, the objects within objects syntax). Any thoughts on how can I improve* thi...