|
Three.js (Which i only found out about a few days ago!)
|
|
|
|
|
Thanks....
Thanks
Md. Marufuzzaman
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Could you tell me pls what is this three.js ? how it's work.
|
|
|
|
|
|
Nr 3. should be Prototype and not Protorype.
I wouldn't actually list Script.aculo.us as a framework of it's own right. The last time I saw and made us of it it was for effects and tightly knit with Prototype. Any pointers to the contrary are welcome.
Cheers!
|
|
|
|
|
|
guys;
what is deference between eval('somecode();'); and setTimeout('somecode();', 0); ?
thanks;
Help people,so poeple can help you.
|
|
|
|
|
Functionally, in this case, there is no real effective difference in their behaviour as far as the end result goes. Historically, eval has been a real resource hog because it would start up a new instance of the JS compiler (similarly, the same issue as setTimeout or setInterval ), but newer JS compilers have become much better at caching the eval compilation so this overhead isn't as bad.
|
|
|
|
|
|
Pete O'Hanlon wrote: Functionally, in this case, there is no real effective difference in their behaviour as far as the end result goes
There is one difference, which this example demonstrates:
<html>
<head>
<title>Eval / setTimeout</title>
<script type="text/javascript">
</script>
</head>
<body>
<div id="myDiv">unchanged</div>
</body>
</html>
|
|
|
|
|
AspDotNetDev wrote: // Uncomment one of the below lines... one will work and one will not.
I didn't get your point here. Of course the un-commented line will work and the commented won't.
..Go Green..
|
|
|
|
|
Lol, I'm not sure if you are joking. What I meant was, uncomment one line at a time. That leaves two scenarios. Only one of those scenarios will function properly. More specifically, the scenario in which you uncomment the eval line will not function. The scenario in which you uncomment the setTimeout line will function properly.
|
|
|
|
|
No, I wasn't joking. I just tested it. The eval one is not working. I haven't used eval ever, so I didn't know about it, until now.
Thanks!
..Go Green..
|
|
|
|
|
Yeah, the reason eval doesn't work is because "myDiv" isn't created yet, and eval tries to immediately evaluate code that references that element. Using setTimeout seems to put the function call onto a procession queue so that it gets called once the current operation (loading the HTML) is complete.
|
|
|
|
|
AspDotNetDev wrote: <layer>Yeah, the reason eval doesn't work is because "myDiv" isn't created yet, and eval tries to immediately evaluate code that references that element.
Correct! And if you move the script after the body tag, both will work.
AspDotNetDev wrote: Using setTimeout seems to put the function call onto a procession queue so that it gets called once the current operation (loading the HTML) is complete.
Yeah, it seems the function is executed only after the whole HTML is loaded.
..Go Green..
|
|
|
|
|
"eval" will execute "somecode()" right away. "setTimeout" will execute "somecode()" at a later time (even with the duration set to 0).
|
|
|
|
|
How later?
Help people,so poeple can help you.
|
|
|
|
|
I am not sure exactly, but I think it will execute next chance it gets (i.e., after the current processing is complete). So, for example, if the page is still loading, the JavaScript will run after the page has loaded.
|
|
|
|
|
ok, sir;
i have used setTimeout() with 0 time to call client method when a message box dialog got closed. actualy i am not good in javascript, but i sow that call in some web resources used in ajax controls toolkit for asp.net.
plaese take a look at my article of Message Box Control[^] and tell me what do you think;
regards;
Help people,so poeple can help you.
|
|
|
|
|
Hi ,
I on button click I open a jquery modal with iframe which loads another aspx page.
Now this other aspx page makes a call to webservice and then loads data. I have the service call on the page load of this page.
So there a gap between the modal window opens and the data load in it.
How can I implement a wait gif or just a text like say 'processing' till the data loads?
Thanks
My code is as below
<div id="mydiv" >
<iframe id ="popup" width ="100%" height="50%"></iframe>
</div>
jquery/javascript
function openDialog() {
var url = "test.aspx?NAME=" + encodeURIComponent($("#<%=txtName.ClientID %>").val());
$("#popup").attr("src", url);
$("#mydiv").dialog('open');
}
$(document).ready(function() {
$("#mydiv").dialog({
autoOpen: false,
modal: true,
width: 500,
scroll: true
});
});
|
|
|
|
|
You don't really need to use an iframe in this instance, at least that I can see. iframes are typically used to display content from a different source, like a different URL. You can simply replace the the HTML content of the div. That would give you more control over the process
The general idea is
function openDialog()
{
$("#wait").show();
$.ajax({
url: "test.aspx?NAME=" + encodeURIComponent($("#<%=txtName.ClientID %>").val());,
success: complete;
}
});
}
function complete(result)
{
$("#wait").hide();
$("#mydiv").html(result);
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I have a problem and i can't figure out why th setTimeout function in this object doesn't tick...
Everything else work just fine but the no ticking. I've struggled with this almost all day but
i ca'nt get the setTimeout working...
Please u wiser ones, hjälp mej...auttakaa minua...help me...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="application/javascript">
<!--
var objIdCnt = 0;
var objIdPre = "progressBar";
var ProgressBar = Class.create({
initialize: function(Container) {
this.Container = Container;
this.Id = objIdPre + objIdCnt++;
this.Type = 1;
this.Interval = 100;
this.Step = 2;
this.Stopped = true;
this.Min = 0;
this.Max = 100;
this.Position = 50;
this.Width = 100;
this.Left = 10;
this.Top = 10;
this.Visible = false;
this.t;
this.IncDecTotal = 0;
this.IncDec = 0;
this.ValTo = 0;
},
create : function(position, value)
{
if(this.Container == null)
{
alert("No container.");
}
else
{
var progBarImage;
progBarImage = document.createElement('IMG');
progBarImage.setAttribute("id", this.Id);
progBarImage.src = "img/Frame_200x16.png";
progBarImage.style.backgroundRepeat = "no-repeat";
this.Width = progBarImage.width;
progBarImage.style.backgroundPosition =
-(this.Width - (this.Position - this.Min) /(this.Max - this.Min) * this.Width) + "px 0px";
this.Container.appendChild(progBarImage);
this.Container.style.position = "absolute";
this.Container.style.left = this.Left + "px";
this.Container.style.top = this.Top + "px";
this.setType(value);
this.setPosition(position);
}
},
hide : function()
{
$(this.Id).style.visibility = "hidden";
},
show : function()
{
$(this.Id).style.visibility = "visible";
},
setPosition : function(position)
{
this.Position = position;
if(position > this.Max)
{
this.Position = this.Max;
clearTimeout(this.t);
}
if(position < this.Min)
{
this.Position = this.Min;
clearTimeout(this.t);
}
$(this.Id).style.backgroundPosition =
-(this.Width - (this.Position - this.Min) / (this.Max - this.Min) * this.Width) + "px 0px";
},
setType : function(value)
{
switch(value)
{
case 1: $(this.Id).style.backgroundImage = "url(img/RedBar_400x16.png)";
break;
case 2: $(this.Id).style.backgroundImage = "url(img/GreenBar_400x16.png)";
break;
case 3: $(this.Id).style.backgroundImage = "url(img/BlueBar_400x16.png)";
break;
}
},
doAnimate : function(value)
{
if(this.Position == value)
{
return;
}
this.IncDecTotal = 0;
this.ValTo = value;
this.IncDec = this.Step;
if(this.Position > value)
{
this.IncDec = -this.Step;
}
this.Stop = false;
this.timedAnimate();
},
timedAnimate : function()
{
this.setPosition(this.Position + this.IncDec);
if((this.IncDec < 0) && (this.Position <= this.ValTo))
{
clearTimeout(this.t);
this.Stop = true;
}
else if((this.IncDec > 0) && (this.Position >= this.ValTo))
{
clearTimeout(this.t);
this.Stop = true;
}
else
{
this.t = setTimeout("this.timedAnimate()", this.Interval);
}
},
sleep : function(delay)
{
var start = new Date().getTime();
var cur = start
while(cur - start < delay)
{
cur = new Date().getTime();
}
}
});
-->
</script>
</head>
<body>
<div id="progBar0"></div>
<br />
<input type="button" value="+5" onclick="progress0.setPosition(progress0.Position + 5);" />
<input type="button" value="-5" onclick="progress0.setPosition(progress0.Position - 5);" />
<div id="progBar1"></div>
<div id="progBar2"></div>
<script type="application/javascript">
<!--
var progress0 = new ProgressBar($("progBar0"));
var progress1 = new ProgressBar($("progBar1"));
var progress2 = new ProgressBar($("progBar2"));
progress0.create(25, 1);
progress1.Top = progress0.Top + 50;
progress1.create(50, 2);
progress2.Top = progress1.Top + 50;
progress2.create(75, 3);
progress1.doAnimate(100);
-->
</script>
</body>
</html>
</code>
If u want the images for testing, just ask...i'm glad to send them.
GBY:Olli.
Do u want to be always right or do u want to be happy...
|
|
|
|
|
Instead of this:
setTimeout("this.timedAnimate()", this.Interval);
Do this:
setTimeout(this.timedAnimate, this.Interval);
With your version, you are passing in a string, which gets evaluated when setTimeout runs your code rather than when you call setTimeout. So, "this" refers to a different scope/context. The solution is to pass in the actual function you want to be called.
|
|
|
|
|
I tried but it didn't worked...is the 'this' pointing window object rather than the object
i've created, if so do i have to move the timed animate to global or can i somehow other
way point it to window.setTimeout method?
I tried also use of closure attribute like setTimeout(function() { timedAnimate(); }, this.Interval),
but noo-ou-ou nothing happened.
i tried like this:
doAnimate : function(value)
{
if(this.Position == value)
{
return;
}
this.IncDecTotal = 0;
this.ValTo = value;
this.IncDec = this.Step;
if(this.Position > value)
{
this.IncDec = -this.Step;
}
alert("this: " + this + " this.IncDec: " + this.IncDec);
this.Stop = false;
this.timedAnimate();
},
timedAnimate : function()
{
this.setPosition(this.Position + this.IncDec);
if((this.IncDec < 0) && (this.Position <= this.ValTo))
{
clearTimeout(this.t);
this.Stop = true;
}
else if((this.IncDec > 0) && (this.Position >= this.ValTo))
{
clearTimeout(this.t);
this.Stop = true;
}
else
{
this.t = setTimeout(timedAnimate, this.Interval);
}
},
</code>
Olli.
|
|
|
|
|
Instead of this:
this.t = setTimeout(timedAnimate, this.Interval);
Try this:
this.t = setTimeout(this.timedAnimate, this.Interval);
|
|
|
|