We can create a function p in the following code:
var p = function() { };
if (typeof(console) != 'undefined' && console.log) {
p = function() { console.log(arguments); };
}
but the arguments are passed like an array to console.log, instead of passed one by one as in
console.log(arguments[0], arguments[1], arguments[2], ...
Is ...
I've been pounding my head on the wall trying to figure out how to sort this in JavaScript (I have to work with it in this format unfortunately).
I need to sort it based on Small, Medium, Large, XL, XXL (Small ranking the highest) in each variationValues size field. The problem is that I need to sort the variationCosts and variationInve...
I have a custom piece of Javascript which I would like to run on every web page from specific domains, or perhaps simply on every web page.
(If you are wondering: it is not malicious. It allows to display formulas by using MathJax.)
Is that possible? I tried including it in userContent.css, that of course did not work.
A simple Grea...
I have a bunch of images that are guaranteed to have:
minimum width = 200px
maximum width = 250px
minimum height = 150px
maximum height = 175px
What I want to do is display a consist 200px by 150px rectangle of the image while maintaining scale (no stretching or shrinking).
Which means, I might have some overflow.
How can I display...
I want to have a form on our main member page that they can submit on, and then I want to pass the username and password to the service which will be embedded in an iframe on our site to allow a seamless login.
...
In Javascript, if we are aliasing a function (or, assign a "reference to a function" to another variable), such as in:
f = g;
f = obj.display;
obj.f = foo;
all the 3 lines above, they will work as long as the function / method on the right hand side doesn't touch this? Since we are passing in all the arguments, the only way it can me...
I am finding a strange behaviour of UIWebView.
In the delegate
- (void)webViewDidFinishLoad:(UIWebView *)webView{
[self changeFont];
//[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(changeFont) userInfo:nil repeats:NO];
}
In changeFont, I am calling the javaScript to change font of web page...
function Psend()
{
new Ajax.Request('Handler.ashx',
{
method: 'get',
onSuccess: function(transport) {
var response = transport.responseText || "no response text";
//alert("Success! \n\n" + response);
var obj = response.evalJSON(true);
...
Ok, here is my question: in javascript you can declare a variable and if it's undefined you can apply variable == undefined, I know that but how can you compare a value that you dont know yet if it's in the cpu memory. I have a class which is created when the user clicks a button. Before this the class is undefined, it doesn't exist anyw...
For example:
<div id="d">ss</d>
How can I get the div by id?
...
I have a JSON that returns from the server which tabs to build,
so I init them in my JS like this:
$('#tabs').tabs( 'ajaxOptions', {
timeout: 20000,
error: function(xhr, status, index, anchor){
console.log( status, index, anchor );
}
})
.tabs('add', item.CategoryLink, item.CategoryName);
Thing is, when I click a tab...
i enable gzip for javascript file in my iis settings, here 's the corresponding config section.
<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="10" dynamicCompressionLevel="8" />
<dynamicTypes>
...
I'm starting on a javascript MMORPG that will actually work smoothly. Currently, I created a demo to prove that I can move characters around and have them chat with each other, as well as see eachother move around live.
http://set.rentfox.net/
Now Javascript timers are something I have not used extensively, but from what I know, corr...
Which is the better way of using the image as a link..
<A HREF="javascript:password()">
<IMG SRC="pict1.gif" NAME="pic1" ALT="about us!" BORDER="0" align="left"></A>
or the same thing using onClick in the img tag ??
Which one is advisable?? Are both equally good to use??
...
navigator.onLine is still returning true when I turn off Wi-Fi (Airport on my notebook in OS X). This is counterintuitive behavior. But when I set "work offline" in a browser like Firefox, it correctly returns false. Is this expected?
alert(navigator.onLine ? "online" : "offline");
...
All,
I have the following Zend application structure:
helloworld
- application
- configs
- controllers
- models
- layouts
- include
- library
- public
- design
-- css
-- site.css
-- js
-- global.js
-- images
-- siteheader.gif
-- sitefooter.gif
...
So, I have this JavaScript function:
ME.Utils = {
RxEmail: new RegExp(/^(("[\w-\s]+")|([\w-]+(?:\.[\w-]+)*)|("[\w-\s]+")([\w-]+(?:\.[\w-]+)*))(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)|(@\[?((25[0-5]\.|2[0-4][0-9]\.|1[0-9]{2}\.|[0-9]{1,2}\.))((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[0-9]{1,2})\.){2}(25[0-5]|2[0-4][0-9]|1[0...
I have a person object and wants to store it into a global ArrayCollection I have made.
Works great in normal scope:
var s = new ArrayCollection();
s.add(new person("Knud", "Mikkelsen", 35));
The problem is when I want to add people inside my jQuery function "mainFunction".
I can't seem to get it right. I know it's something to do wi...
Hi guys, I have a bit of a problem with my shadowbox, it works fine in FF, but it refuses to work in IE 7 or 8.
I am using these scripts,
<script type="text/javascript" src="scripts/jquery-1.4.2.js"</script>
<link rel="stylesheet" type="text/css" href="scripts/shadowbox/shadowbox.css">
<script type="text/javascript" src="scripts/shadow...
In the following code:
<script type="text/javascript">
var i = 10;
function Circle(radius) {
this.r = radius;
this.i = radius;
}
Circle.i = 123;
Circle.prototype.area = function() { alert(i); }
var c = new Circle(1);
var a = c.area();
</script>...