|
Finally, I tried the following code.
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];
var arr = [];
var tmp = 0;
var IsElm = 0;
function indexe(){
for(var i=0; i<arrIns.length-1; i++)
{
if(arrIns[i] != arrIns[i+1]) {
IsElm = i;
arr[tmp++] = arrIns[i];
arrIns.splice(arrIns[IsElm]);
}
return --IsElm;
document.write(arr[tmp++] + " : " + arrIns.indexOf(arrIns[i]) + "<BR>");
}
}
Hakan cursed chats dealer
|
|
|
|
|
Hakan cursed chats dealer
|
|
|
|
|
I used to ur method
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45"
];
var arr = [];
var AllLucky= [];
var ct = 0;
var n = 0;
do{
for(var i=arrIns.length; i>0; --i)
{
arrIns[i] = arr[i];
for(var j=0; j<arrIns.lenght; j++)
{
if(!arrIns[arr[j]]) {
arrIns[arr[j]] = AllLucky[ct];
document.write(AllLucky[ct] + "<BR>");
ct++; n++;
}
}
}
}while(n<1);
output is
24
must be ?
Hakan cursed chats dealer
|
|
|
|
|
I will take a look at today's messages later tonight.
there is spelling mistake, length
for(var j=0; j<arrIns. lenght; j++)
Q. Are you trying to create a 2D table that indexes all of arrIns?
0, "1"
12, "3"
6, "9"
.
.
11, "49"
the line below is deleting arrIns[i] items.
problem is arr[i] = undefined (empty like c++ void).
so, arrIns[i] = undefined.
arrIns[i] = arr[i];
Not enough code to test it.
I need array AllLucky.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
modified 20-Apr-13 17:16pm.
|
|
|
|
|
please explain your signature:
Hakan cursed chats dealer
If you are just messing people about, I will stop helping right now.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
Just kidding!! Please don't offense on you.
Hakan cursed chats dealer
|
|
|
|
|
ok.
post message explain the arrays, differences
AllLucky
arrIns
arr
Help me to see what each one will look like at the end of code.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
modified 21-Apr-13 6:30am.
|
|
|
|
|
if(!arrIns[arr[j]]) is 24 AllLucky[ 24 ] differencly
|
|
|
|
|
9 10 38 40 46 48
there is no pick number this week too lotto combination is uselessness
|
|
|
|
|
Q1. is arr[] lucky numbers to add to existing ?
Q2. So, you want to add new set of lucky numbers to arrIns, but only if they do not exist in arrIns.
Yes?
===============================================
from what you told me before I thought old lucky numbers would get replaced
var arrIns = [
"1","21","24","28","42","48", // week-2 is removed
"9","10","38","40","46","48" // this is new week-2 set
"9","13","14","16","24","49",
"3","18","19","25","44","45",
];
or
var arrIns = [
"1","21","24","28","42","48",
"9","13","14","16","24","49",
"3","18","19","25","44","45",
"9","10","38","40","46","48" // new week-2
]
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
modified 21-Apr-13 9:11am.
|
|
|
|
|
If you get Java SE JRE7 & also install this Rhino Shell
You can experiment with Javascript and learn things better. Using a web browser is no good for learning.
I will help you get it set up and how to use it.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
|
I am trying to call a usercontrol method from within its javascript. Currently, I am using:
Code behind:
Public bool SaveData()
{
return true;
}
Javascript
if (counter == 50) '<%= this.SaveData() %>';
Now, the problem is the javascript call to the usercontrol method is called as soon as the page loads. How do I get the usercontrol code behind method to be called when the counter == 50?
Thanks,
Steve Holdorf
|
|
|
|
|
Why have you wrapped the <% %> in quotes?
a literal string containing ASP delimiters can't be parsed by the server.
Please forgive me for asking, as you don't go into much depth with an explanation.
but what's wrong with..
if (counter == 50) this.SaveData();
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
server code
[WebMethod]
public bool Foo()
{
return true;
}
the in your javascript I would do something like the following (assuming you are using jQuery):
function callFoo(callBack) {
$.ajax({
type: "POST",
url: "pageName.aspx/Foo",
data: "{}",
contentType:"application/json; charset=utf-8",
dataType: "json",
success: function (msg) {
if(undefined !== callBack) {
callBack(msg);
}
}
});
}
then to change your code I would have the following:
if(50 === counter) {
callFoo(function(e) {
});
}
I haven't tested this so you will have to veriy it yourself but maybe this will get you started. I am sure there are some articles on this site about calling a WebMethod from javascript.
Best of luck.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Thank you very much for your help. One question. Does your example cause a postback? I am trying to call the method without a postback.
Thanks,
Steve Holdorf
|
|
|
|
|
Steve Holdorf wrote: One question. Does your example cause a postback?
the nature of an AJAX call is that the are asynchronous.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Again thanks. One problem for me; however, I am using AJAX but not jquery. I still hope there is another solution using just AJAX. Again thanks!
Steve Holdorf
|
|
|
|
|
you can still do it without jQuery however you would have to handcode the call and deal with the various flavors of browsers that are out there. the benefit of jQuery is that encompasses all the nuances of the different browsers for you.
I personally would recommend your going the route of using some javascript framework.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|
Again thanks for sharing your knowledge!!!! I am still a little lost. Can anyone post a small demo or a link to one?
Again thanks!!!
Steve Holdorf
|
|
|
|
|
|
Then go back again to that article and read a bit more carefully. The article explains how to achieve the same goal using standard AJAX and then also utilizing jQuery. So the answer is there. If you'll look again just search for "Using XMLHttpObject". The part using jQuery is under the heading "Using jQuery". I do think these two shouldn't be too hard to distinguish.
Regards,
— Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|
Manfred,
Sorry about the repeated posts. It won't happen again.
Thanks,
Steve Holdorf
|
|
|
|
|
I have created a elevator functionality [there are 2 floors and corresponding to each one , there is a checkbox. Depending upon which checkbox is checked, the elevator should move to that floor.
Only thing which i am not able to implement here is:
Make the checkbox check automatically and slowly fadeout to unchecked state when the orange elevator has reached that checkbox.
Here is the link to the markup and script: http://jsfiddle.net/hurricaneankit/qR4uJ/
|
|
|
|
|
I think I have seen something very similar to this on various interviews.
either way the following should get you started:
http://jsfiddle.net/qR4uJ/3/[^]
I would recommend that you fix your images because they are the cause behind the "jumpy" appearance of the checkbox when you click on things.
as I think about it more I would recommend stacking images. have the checkbox as your background and then a check mark as an img tag that can sit on top of it. then you can use the fadeIn[^] and fadeOut[^] parts of jQuery.
best of luck.
as if the facebook, twitter and message boards weren't enough - blogged
|
|
|
|
|