Hi,
I'm trying to understand why JSLint complains about an implied global variable in the following example:
var TEST = (function () {
var count = 0;
function get_count() {
return add_one();
}
function add_one() {
count += 1;
return count;
}
return {
get_count: get_count
};
}());
Running this throu...
I'm working on a script to click a button. The button is part of a script that is embedded on a website. The embedded script is here: http://pastebin.com/jsBiYZxi I'm fairly new to Greasemonkey and javascripting in general and I'm hitting a road block trying to accomplish this. Can anyone give me some pointers or suggestions?
...
I am trying to parse to JSON object in java. I am posting json key value object using dojo.xhrPost() method as shown below:
dojo.xhrPost({
url: /esturl/,
handleAs : "text",
content : {INST1 : {"0001" : "aa"},
INST2 : {"0002" : "bb"},
INST3 : {"0003" : "cc"}},
load : load(data),
error : error
});
Now I am readin...
Hi All
I'm trying to combine the official jQuery accordion plugin with another JQ plugin called 'GallerificPlus' (Gallerific & Lightbox in 1).
Unfortunately it doesn't work for me. The GallerificPlus is the one that doesn't work, the accordion works fine. Firebug reports no errors, so this could be anything. It's really frustrating.
...
How can I assign a variable to content attr of dojo.xhrPost dynamically ? Below is the code and some explanation for my scenario:
Code with hard coded values for content
dojo.xhrPost({
url: /esturl/,
handleAs : "text",
content : {INST1 : '{"0001" : "aa"}',
INST2 : '{"0002" : "bb"}',
INST3 : '{"0003" : "cc"}'}
l...
Hi
I need to show an alternate image in cell of table if source image is not found.
Currently below code is used to do so.
cell.innerHTML="<img height=40 width=40 src='<%=request.getContextPath()%>/writeImage.htm' onError='ImgErrorVideo(this);'>"
function ImgErrorVideo(source){
source.src = "video.png";
source.onerror...
Hi All,
http://localapartmentdeals.com/
on the above site there is a location bar and if you type any state (US) it will display an autosuggest list but it will not allow key board strokes to select the list,
eg: no down arrow is working there.
any help please
thanks
deve
...
In ruby, I often use something like this:
if "my string123" =~ /string(\d+)/
puts "I got #{$1}"
end
How would I do something similar in javascript? Currently, I've been doing this but it feels dirty.
m = "my string123".match(/string(\d+)/)
if (m)
puts "I got " + m[1]
Perhaps I should just live with this, but thought I'd ask if...
Initially, I used this function:
function findIndexesMultiPass(find,str) {
var x, output = {};
for (var i = 0; i < find.length; i++) {
output[find[i]] = [];
x = 0;
while ((x = str.indexOf(find[i], x)) > -1) {
output[find[i]].push(x++);
}
}
return output;
}
var search = ['a',...
Firebug looks not capable to check js syntax error...
Is there any good way to do that?
Currently I just wrote a js but the firebug didn't show any error but the functionality is totally broken.
...
<table width=100%>
<tr>
<td id="show1" class="centerNoBorder"> <input type="button" name="upd_rate" value="Update Rate" onclick="showEdit(1)"></td>
</tr>
<tr>
<td id="show2" style="display:none" class="centerNoBorder"> <input type="button" name="upd_rate" value="Save" onclick=" updateRate(); sho...
<table width=100%>
<tr>
<td id="show1" class="centerNoBorder"> <input type="button" name="upd_rate" value="Update Rate" onclick="showEdit(1)"></td>
<td id="show2" style="display:none" class="centerNoBorder"> <input type="button" name="upd_rate" value="Save" onclick=" updateRate(); showEdit(2)"></td>
...
I'm trying to expand a div to fit text without having to specify an exact hegiht. I tried using something like.
$('#div').addClass('myclass');
With myclass having a height:auto; but that won't work. I don't know how to get it to expand the div accordingly from an ajax call that returns text.
This is the main css class
.pro_input{
b...
Is there some CSS property or something that I can use with my anchor tag so as to make it unclickable or I HAVE to do stuff in code behind to get what I want?
[edit]
onclink=return false; is refreshing the page..I dont want that..want this anchor tag to appear as a plain text..actuaaly I have css applied on anchor tag..so cant change i...
I apologize in advanced if this question is too broad. In fact it's 4 different questions, but all related to the same piece of code, and I think they all revolve around the same principle.
I decided today, after using JS for years, to actually start learning how JS works instead of treating it like C that runs in the browser. So I star...
Hey,
Im trying to make a nested array in JS
var lines = new Array(
"0"= new Array(
0['time']="10:00:00",
0['user']="User1",
0['content']="Line1",
),
"1"= new Array(
...
I have javascript function:
function someAction(thisTd,text){
alert(text);
thisTd.innerHTML=text;
...
}
And html-file:
<td onclick="someAction(this,<?echo 'Long-long text with <b>html-formatting</b>'?>)"/>
When I use such code function someAction doesn't call (because alert doesn't show) and in the error console in Opera no e...
Hi, please take a look at the following code.
var oFra = document.createDocumentFragment();
var myDiv = document.createElement("div");
myDiv.id="myId";
oFra.appendChild(myDiv);
oFra.getElementById("myId");
In this case do i have ref to the div i just inserted inside documentFragement using the variable myDiv?
Lets sa...
I can't get this to do what I want it to do! I'm trying to replace large images with smaller ones for mobile browsers.
Here is the code:
function js_imgs() {
if (document.documentElement.clientWidth <= 600) {
$("img").each(function(){
if ($(this).hasClass('big')) {
var preSrc = $(this).attr('src'...
It seems that all the browsers other than Opera cache XHR requests in my Javascript program.
The URL in the XHR request refers to a CGI program on the server which generates a different output everytime its called. B
Is there a way in Javascript to make the browser not cache XHR requests?
...