Hey guys,
I was reading an article about Javascript's best practices, and kinda got confused about which function structure to use...
I guess it might have an impact on the scope of the variables and functions, but which one of these structures would you use (and which is considered the best practice)?
Structure 1: use the object lit...
I'm opening a web page from Site B, using showModalDialogue (javascript) from Site A.
I want to return a value using window.returnValue from Site B page to Site A page.
But I'm not able to return value between these two applications (both in the same IIS server).
How do I can pass value in this scenario?
...
function openFile(file, object) {
var extension = file.substr( (file.lastIndexOf('.') +1) );
var fileName = file.substr((file.lastIndexOf('/') +1), (file.length - (file.lastIndexOf('/') +1))-4);
object.append('<img class="theimage" src="" alt="icon"/>');
object.append('<span class="thefile"></span>');
switch(exte...
Hello,
I am getting an error in IE 8 that says it does support the use of that object, it works perfectly in Chrome and Firefox however.
item = validateDates({endDate:$('#campaign_to_date').val(), startDate:$('#campaign_from_date').val(), required:"none"});
Not sure what is wrong with it at all, since it's just a method call.
...
Hi,
I have a simple jQuery image changer, that when you hover over it will make swap all images with their grey version except the one you are on, that one will stay colour (They are all colour to begin with) and when you hover over another image, the last image gets changed to grey and the new one gets changed to colour.
However on IE...
What is the most effective way to pass object and category ids or other system variables which shouldn't be presented to the user, from server to the browser?
Let's say I have a list of items where I can do something with each of them by javascript, for example show tooltip html or add to favorites by ajax, or display on a map. Where is...
Based on the JavaScript example below, is there a way to pass a reference to function f to the promptForProceed function and have it conditionally executed in promptForProceed?
Could you also do this if the ffunction took some parameters (ie: f(a, b, c) { ... })?
function f() {
//Do stuff..
}
function promptForProceed(myFunction) ...
Hey all,
I don't expect anyone took read this whole script, but you will notice that there is a sort object with an insert() function that returns an object that use a ternary operator to return either "-order_value" or "order_value", where order_value is a local variable holding a value. Problem is in the query string it always passes ...
Hey all. I am adding a "More Rows" button to a table within a long, complex form, and to add the rows, I am cloning an existing row in the table, modifying it, then appending it to the end of the table.
The row contains inputs that have id and name attributes that are numbered sequentially (e.g. id="Item_Name1" and name="Item_Name1" fo...
I'm rather confused at the moment, could someone explain this one to me? Maybe it's something small I'm oblivious to, but I'm confused as to why this isn't resulting as I expect it to.
I have created a samples to show the issue I'm seeing...
Sample 1
var dataString = "abc";
document.write(" This is a test ... " + "<br/>")
for (i in d...
If I need to see if a certain value is in a string, is it better for performance to use the .test() method or the .search() method?
Example with .search():
var myRegExp = '/Orange/',
myString = 'This is a string with the word "Orange."';
if(myString.search(myRegExp) != -1) {
// Do code here
}
Example with .test():
var myReg...
Hey,
Please let me know how to delete specific cookie (I have the name of the cookie its enough..).
I really dont have an idea (I dont know JS well...) and when I searched in Google I didn't find a good solution.
Thank you.
EDIT:
If I can't delete the cookie - let me know how to change the value to "" (empty..), its ok too.
...
There are some times when I find myself repeating a selector several times. Should I be somehow storing a jquery object to a variable and then just using that one? As a quick example, what about the following?:
$('a.contactus).css('padding', '10px');
$('a.contactus).css('margin', '4px');
$('a.contactus).css('display', 'block');
Now I ...
I'm working on a bookmarklet which uses jQuery UI Dialog. I understand that frameset doesn't allow div to be inserted, thus the dialog won't show. Need some ideas to overcome this issue.
...
I'm caching label strings by saving them into a variable, but running into weird scoping issues. I know this has to do with closures, but I can't seem to figure out what the issue is exactly.
info_lbl = {};
$("#chkCorporateGift").click(function(){
var type = $(this).is(":checked") ? "Corporate" : "Personal";
if(!info_lbl.hasO...
How to hide cursor in asp.net textbox using JavaScript? I don't want see blink thing in textbox.
...
How can I execute a desktop application from a browser?. I have a web page with a button, when user click this button a simple java desktop application must run. How can I do this using jsp or javascript?
...
We have three JS files:
<script type="text/javascript" src="js/pm.init.js"></script>
<script type="text/javascript" src="js/pm.util.func.js"></script>
<script type="text/javascript" src="js/pm.nav.js"></script>
In init.js we have:
$(function(){
var dirty = false;
})
In util.func.js we have:
function dirtyCheck(actionFuncti...
I have a web page that uses the ASP.net Tree View web control. As the web page is currently programmed, when the user clicks on a node on the tree view, the page posts back and a C# function executes to handle the event.
Can I make my web page run some Javascript code and not post back when a tree view node is clicked?
Update: Suppos...
(from failblog)
Not only the background's been changed but also the buttons. How can this be done?
...