<script>
//in one script
var someVarName_10 = 20;
</script>
I want to get access to this variable from another script by name of variable. With window object its simple, is it possible with local variable?
I mean access this var by code like this:
<script>
alert(all_vars['someVar' + 'Name' + num]);
</script>
...
I'm trying to write a helper method in JavaScript. It should act differently if one sends in a function or an reference to a function.
I want to like to use it like this:
helper('div', function () { return false; })
helper('div', obj.fn)
What I can't figure out is: how to inside the helper function tell the difference between the two...
Quite new to this mocking thing, I have a couple of questions.
Correct me if I'm wrong:
Mocking does not initialize the real method i.e. Mocking will not actually call the constructor of your class. Instead it does something like look at the signature of the class and create an object with that signature but with none of the methods fun...
Hi,
when pressing Shift+Left+Alt+Print Windows switchs into high contrast mode - is there any chance to detect that on a webpage (using JavaScript or CSS)?
Is there any chance to detect that in the HTTP-Request (a.k.a the server-side e.g. via PHP or Ruby)?
Cheers
...
Hi,
I am trying to configure TinyMCE to use absolute paths, but even though I've tried every trick in the documentation i cant seem to get it working.
This is how i have my configuration:
tinyMCE.init({
"theme": "advanced",
"strict_loading_mode": 1,
"mode": "exact",
"language": "no",
"spellchecker_languages": "+Nor...
Hi all, I have a problem with my select .. Default value is "please choose" .. but there are some options like "Acommodation & Hotels" .. so its bigger than the default value .. so its not clearly seen on IEs, it works ok in FF, how can I do this? with css or javascript? what is the best solution ? thank you
NOTE : I want to strech the ...
In RhinoMocks or Moq, can properties on an object be set before the constructor is called?
I'm trying to test a method.
The class containing the method has some code in it's constructor which depends on some members being set, unfortunately there's no params in the constructor to set them so I must set them through a property. Is ther...
This is basic.
How do I get the value 'This is my name' of the above span?
<div id='item1'>
<span>This is my name</span>
</div>
...
I'm looking at putting together a good way of caching results of AJAX queries so that the same user doesn't have to repeat the same query on the same page twice. I've put something together using a Hash which works fine but i'm not sure if there's a better method i could be using. This is a rough snippet of what i've come up with which s...
I've been looking into offline database storage with HTML5 and the built in Sqlite Db. I think it has a potential for things other than just storing data for offline apps.
What I'm interested in, is hearing about potential uses of the database for storing things other than offline web page content. What has anyone in the commnity been u...
I am currently working on google map and new to it..
I want to know is it possible to divide the map into certain tiles with definite height and width and to color them.. If yes then somebody can just explain how to do it as i am facing difficulties.
...
Hiya All,
I have a Google Map on our site that has a list of markers which are brought in using the following code:
$(".map-overlay-right").click(function () {
var map = new GMap2(document.getElementById('map-holder'));
$("#map-holder").fadeOut('slow', function(){
var gmarkers = [];
map.addControl(new GSmallMapControl()...
How would you go about profiling a site/script in terms of determining if / what memory leaks occur? Basically, it's a mootools page (which has a built in garbage collector) that sports 2 sort-of cpu-intensive script elements. one of them scrolls some images left to right and back, the other rotates content of 3 elements with some built-...
I want store data from an html page to a text file using javascript on Client Side. Any method is there?
...
How can you implement regions a.k.a. code collapse for JavaScript in Visual Studio?
If there are hundreds of lines in javascript, it'll be more understandable using code folding with regions as in vb/C#.
#region My Code
#endregion
...
PCRE: /\A[A-Z0-9_\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[a-z]{2,4}|museum|travel)\z/i
POSIX: /^[A-Z0-9_\.%\+\-]+@(?:[A-Z0-9\-]+\.)+(?:[A-Z]{2,4}|museum|travel)$/i
This regex is correct in every way for my needs except that it allows emails such as [email protected]. It says these are a match. If I'm not mistaken, doesn't the {2,4} after [A-Z] mean th...
I have a textbox collecting user input in my JS code. I would like to filter junk input, like strings that contain whitespaces only.
In C#, I would use the following code:
if (inputString.Trim() == "") Console.WriteLine("white junk");
else Console.WriteLine("Valid input");
Do you have any recommendation, how to do the same in JavaSc...
How we can call webservice from html page using javascript
...
Hi,
On cnn.com with Firefox 3.5.3, there seems to be a bug with the measurements of document.body. It seems document.body.offsetHeight and document.body.scrollHeight both give the viewable height, thus same as document.body.clientHeight. Same with document.documentElement.offsetHeight and document.documentElement.clientHeight. Only docu...
I'm just sounding things out about this having looked around for a while and drawn a blank. I'd like to see if this is even possible as so far I can't see a way to do it.
I want to encrypt a file locally (in the browser using existing libraries) before uploading it. Then I'll need to retrieve it and decrypt it before presenting the file...