|
ha ha ha
I forgot it was Simon;
I don't know what made me think of Eric.
I think I know, it's the enh in your handle, Eric just popped up in my head for some reason.
Thanks for pointing out that extra parseInt, I'll take care of it right now.
That should do the trick for now. Thanks for the eyes on the script!
Jim
|
|
|
|
|
It's a pleasure as always, Jim.
Make it work. Then do it better - Andrei Straut
|
|
|
|
|
I thought I would get back to playing with KnockoutJs in a simple HTML and JS environment using JQuery to access JSON data from Web Services.
My question is, how do/would you set up the various JS files and folders in your web application?
I mean, physically, do you create a single JS file per ViewModel and a single HTML file for the view ? Do you put them in the same folder, or have everything at the root?
I'm not a web developer, so be gentle - use shot words
Also, does anyone have experience using Typescript with KnockoutJs. I'm just about to start and would appreciate any help/advice.
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
_Maxxx_ wrote:
My question is, how do/would you set up the various JS files and folders in your web application?
My own JS goes into "scripts" folder. The rest, JQuery, Knockout etc. are fetched from CDNs.
_Maxxx_ wrote: do you create a single JS file per ViewModel and a single HTML file for the view ?
Nope... but some say to do so.
_Maxxx_ wrote: using Typescript with KnockoutJs
I'ven't use Knockout yet, Typescript it's good... atleast from the documentation, I'm also starting to use it. It's a compiler that compiles typescript into javascript. Write your code, feed it to the compiler and use the generated JS in your website. Easy Peasy!
|
|
|
|
|
Amitosh Swain wrote: My own JS goes into "scripts" folder. The rest, JQuery, Knockout etc. are fetched from CDNs.
Yep - I do that - but I wasn't sure about the VMs created for Knockout - whether they go with the scripts, in a subfolder of scripts, or with the html 'views'
The TypeScript idea is great (I actually thought about doing something like it myself but MS must have been tapping my thoughts )
What I am trying to figure out is exactly how to write a Knockout VM using TypeScript "properly"
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
_Maxxx_ wrote: Knockout VM using TypeScript "properly"
Knockout + Typescript... Good Idea, but never tried it.
|
|
|
|
|
_Maxxx_ wrote: I mean, physically, do you create a single JS file per ViewModel and a single HTML file for the view ? Do you put them in the same folder, or have everything at the root?
I've used both Knockoutjs and Typescript in a project. I kept my jquery knockout etc in the Scripts folder, but then created a folder structure that matched the namespaces of my project.
At that point, if I were working on controls for the application, I would create all my VM's and HTML files separately but keep them together in that folder.
_Maxxx_ wrote: Also, does anyone have experience using Typescript with KnockoutJs. I'm just about to start and would appreciate any help/advice.
Typescript is a great tool for developing javascript. As a C# developer initially, it made the transition to javascript rather painless. The features in the latest release which include being able to develop with generics has the potential to greatly reduce the amount of code needed to be written by hand for a project.
Typescript also has ambient declaration files that support a wide range of javascript libraries. You can find them all here.
Hope this helps!
"In the middle of difficulty lies opportunity." Albert Einstein
|
|
|
|
|
Payrok wrote: Hope this helps!
Thanks - yes it does - following that link right now!
MVVM # - I did it My Way
___________________________________________
Man, you're a god. - walterhevedeich 26/05/2011
.\\axxx
(That's an 'M')
|
|
|
|
|
hey guys.
I m looking for 1 or 2 people to start creating a RPG online game with HTML5, nodejs and any other technology that is needed.
the thing i have in mind is a 3d game with low res but good looking game like http://www.playtankworld.com/
three js is awesome but i dont know if it's just in a point that such a game can be created with.
the alternative idea is a classic 2d sprite base game.
i have really good ideas in mind so it can be really awesome.
any suggestion, help will be appreciated.
lets be the first.
|
|
|
|
|
|
sure, thanks, help me delete this here please
|
|
|
|
|
Hi,
Below code is not working in IE-8 but it is working good in all other browsers. I am not able to understand what is wrong in this code as it is very simple one.
<a href="abc.htm" target="_blank;">Click here</a>
When I click on a link nothing happen. Please let me know how to fix this for IE.
Thanks in advance,
Inder...
|
|
|
|
|
InderK wrote: target="_blank;"
Try removing the semi-colon from the end of your target value.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
No, not working after removing semi-colon.
|
|
|
|
|
should work is this working?
<A href="http://facebook.com/" target=_blank><IMG border=0 align=center src="images/1.png"></A>
??
|
|
|
|
|
<A id="id" href="aa" target="_blank"><IMG class=bn alt=banner src="banner/Water lilies.jpg" width=170 height=284></A>
try likethisone
|
|
|
|
|
I am trying to create a dynamic collapsible-set which would contain text and image. Texts are appearing fine but as soon as I try to write code (see commented line) for image, browser doesn't display it correctly. It takes 2-3 clicks to open the collapsible, and it gets stuck most of the time. Here is my code:
<pre lang="Javascript">
$("#dvAccordion").empty();
var outdiv = $('<div data-role="collapsible-set"></div>');
$(strXML).find('Category').each(function(){
var colldiv = $('<div data-role="collapsible" data-collapsed="true"></div>');
colldiv.append('<h3>' + $(this).find('Category_Name').text() + '</h3>');
var uldiv = $('<ul data-role="listview" data-inset="false"></ul>');
colldiv.append(uldiv);
$(this).find('Menu_Item').each(function(){
var sItemName = $(this).find('item_name').text() ;
var sImageUrl = "images/food1.jpg" ;
uldiv.append('<li><a href="menu.html" rel="external">' + sItemName + '</li>');
});
outdiv.append(colldiv);
outdiv.appendTo('#dvAccordion');
});
$('#dvAccordion').trigger('create');
Where am I wrong? If I try to generate the collapsible with listview and images static way in html - everything works fine.
jsFiddle - http://jsfiddle.net/yesprasoon/68v8p/
Surprisingly, images are appearing properly in fiddle. But it doesn't appear in my local file/ localhost address/ phonegap application.
modified 15-Jun-13 9:45am.
|
|
|
|
|
I am generating a dynamic collapsible-set with listViews using XML data. It's generated correctly, but I need a click/touch event to display some data before it goes to another page. Here is my code:
$("#dvAccordion").empty();
var outdiv = $('<div data-role="collapsible-set"></div>');
$(strXML).find('Category').each(function(){
var colldiv = $('<div data-role="collapsible" data-collapsed="true"></div>');
colldiv.append('<h3>' + $(this).find('Category_Name').text() + '</h3>');
var uldiv = $('<ul data-role="listview" data-inset="false"></ul>');
colldiv.append(uldiv);
$(this).find('Menu_Item').each(function(){
var sItemName = $(this).find('item_name').text() ;
uldiv.append('<li data-name="baby"><a href="menu.html" rel="external">' + sItemName + '</a></li>');
});
outdiv.append(colldiv);
outdiv.appendTo('#dvAccordion');
});
$('#dvAccordion').trigger('create');
I am adding an eventListener on page load like this:
$('#dvAccordion ul').children('li').bind('vclick', function(e) {
alert('Selected Name=' + $(this).attr('data-name'));
});
Where am I wrong? If I try to write the same event listner after developing collapsible in static way in html - everything works fine.
jsfiddle - http://jsfiddle.net/yesprasoon/MvcHm/
modified 15-Jun-13 9:41am.
|
|
|
|
|
Java?
Post it elsewhere, Java has no connection to Javascript, and it doesn't qualify as a question either.
|
|
|
|
|
He's a spammer.
Use the best guess
|
|
|
|
|
ok.
|
|
|
|
|
I am developing a small html/js application where one window calls another , just to keep functionalities separated .
I need to reference , in the child window (opened with window.open (url....) etc) , an object, lets call it obj, defined in the opener.
I can correctly see, in the child window, all the methods, and all the properties with the values corresponding to the ones set in the opener. But when it comes to modify them, it looks like I am modifying a copy of the object : I send an alert in the child window to verify I correctly changed the value of the properties, but when debugging the parent (opener) window, it seems like those changes didn't happen at all, that is I see the old values.
I reference the parent's object, in the child window, as : self.opener.obj. I thought this represented a reference to the parent's object, but what's happening lets me think this is just a reference to a copy of that object, not the object itself.
Is it correct ?
|
|
|
|
|
Hello. I am attempting to create a small app that rotates images, with buttons to stop, slow or speed up the animation, or to start/reset.
The button functions work, but when they try to contact another function (setSpeed) or even use setTimeout or setInterval, those are ignored. Putting in other commands in those functions (e.g. window.alert("test") statements yields results, so I know it's doing something.
Any help would be much appreciated...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Animation</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<script type="text/javascript">
<!--
var myFx;
currImage = "pennant2.gif";
xName = "dhtmlFx";
speedVar = 500;
speedVal = 100;
maxVal = 1500;
stopSpeed = 99999;
var startFlag;
startFlag = 1;
y = speedVar;
function startMe()
{
startFlag = 1;
myFx = setInterval(doFx, speedVar);
}
function doFx()
{
currImageObj = document.getElementById(xName);
myText = document.getElementById("dhtmlText");
myText.textContent = y;
if (currImage == "pennant2.gif") {
currImageObj.src = "pennant1.gif";
currImage = "pennant1.gif";
} else {
currImageObj.src = "pennant2.gif";
currImage = "pennant2.gif";
}
}
function startThis()
{
if (startFlag == 0)
{
y=speedVar;
startFlag = 1;
setSpeed(y);
} else {
window.alert(startFlag + " Animation already started");
}
}
function slower()
{
y+=speedVal;
if (y>= maxVal )
{
y=maxVal;
}
startFlag = 1;
setSpeed(y);
}
function faster()
{
startFlag = 1;
y-=speedVal;
if (y<= 0 )
{
y=1;
}
if (y > maxVal)
{
y = maxVal;
}
setSpeed(y);
}
function stopThis()
{
startFlag = 0;
y = stopSpeed;
clearInterval(myFx);
}
function setSpeed(y)
{
clearInterval(myFx);
var myFx = setInterval(doFx,y);
}
</script>
</head>
<body onload="startMe();">
<img id="dhtmlFx" src="pennant2.gif" height="183" width="388" />
<div id="dhtmlText">0</div>
<form action="" name="animate" >
<input type="button" name="buttonStop" value="START" onclick="startThis();">
<input type="button" name="buttonStop" value="<<" onclick="slower();">
<input type="button" name="buttonStop" value=">>" onclick="faster();">
<input type="button" name="buttonStop" value="STOP" onclick="stopThis();">
</form>
</body>
</html>
Thanks!
modified 11-Jun-13 21:15pm.
|
|
|
|
|
I am assuming that you are trying to change the image based on some interval that you can control via user input. The initial image is most likely coming up but not the other.
The reason is because the second image has not been loaded.
You can either write some code to load the image or you can "stack" the two images and control their visibility via a style/css setting that you adjust during your interval calls.
Best of luck.
you want something inspirational??
|
|
|
|
|
Hi there, I think there is a problem when you call setSpeed():
You clear interval by calling
clearInterval(myFx);
This is the global myFx, but when you set a new interval, you return to a local variable
var myFx = setInterval(doFx,y);
If you remove the "var" in order to use the global myFx variable, the problem should be resolved.
myFx = setInterval(doFx,y);
|
|
|
|