|
I would suggest you post your question at the end of the article and ask the author for help. The actual code looks like it belongs in a web page so it should be part of your web site.
Veni, vidi, abiit domum
|
|
|
|
|
Thank You for your reply. Since as you say this code is meant for a web site, I will not be pursuing this matter any further. Creating a web site is beyond my abilities or interest and adapting it to work locally is also beyond me
|
|
|
|
|
The moment you step up to a device with a screen and method of input you are a computer programmer
|
|
|
|
|
I have a fairly complex (in my eyes) script that loads a JSON data file, and then creates a series of canvas elements (using kinetic.js) to layer these images into a div.
The div background is black, and the images are comprised of a single "background" jpg image, and about 20 png images that are laid on top of the background image.
Sometimes one or more of the following things happen:
0) The background image doesn't get rendered, but the png images do.
1) The background image is displayed on top of the png images (thus blocking them from view because it's a jpg image)
2) Some of the png images don't get rendered.
If I refresh the page after it's display the first time (with F5), it fixes it (sometimes it takes a couple of refreshes to fix it).
I will be able to provide a download link later today if you want to look at the code. Generally, though, I'm looking for ideas regarding things to check/do.
---------------------------------
EDIT: I think I've solved the issue by using the jquery Deferred function.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
modified 27-Dec-13 6:07am.
|
|
|
|
|
format of image must be compatible with browsers.
Don't forget mime type (.httaccess file in folder of images)
e.g. .gif image/gif
.png image/png
reload a page (f5) do not reload complete: browser cache may be filled.
To test complete loading of page please clear browser cache at first.
order of parsing a HTML page:
At first HEAD included Javascript and so on
AFTER and at last BODY included Javascript.
In HEAD do not take a reference at this momen at this BODY must be parsed
e.g. document.body object is created AFTER HEAD !!
do not use document.body in Head if this reference called before BODY created (parsed).
|
|
|
|
|
Hi,
I need a clear explanation and integaration about Model,view and controller in backbone.js in Proper code manner (i.e) an example..
|
|
|
|
|
|
Perhaps this article can help. It is also using marionette framework along with backbone.
A Beginner's Guide for Creating Single Page Applications using Backbone.js and Marionette.js[^]
Think about using marionette with backbone too. it makes the code much more structured.
Twenty years from now you will be more disappointed by the things that you didn't do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore, Dream. Discover.
|
|
|
|
|
|
Hi all,
I want to display the server time and refresh the time every 1 sec using javascript in asp.net but it showing client time when page is runing. So any one can help me to sort out this problem.
Thanks in advance...
Regards,
G Mariappan
|
|
|
|
|
Javascript runs in the client browser, so will reflect the client's timezone. You need to use a mechanism (code behind, AJAX?) to get the data from the server.
Veni, vidi, abiit domum
|
|
|
|
|
Hi Richard,
Thanks for your reply i used javascript to get the server time
please see the below code its works for me
<script type="text/javascript">
//Users time
var timeLocal = new Date();
var timeServer = new Date('<%= DateTime.Now.ToString()%>');
//Calculate the difference (returns milliseconds)
millDiff = timeLocal - timeServer;
//initalize the clock on loading of page
window.onload = function () {
//set the interval so clock ticks
var timeClock = setInterval("TimeTick()", 1000);
}
//The ticking clock function
function TimeTick() {
//grab updated time
timeLocal = new Date();
//add time difference
timeLocal.setMilliseconds(timeLocal.getMilliseconds() - millDiff);
document.getElementById("lblserverTime")=timeLocal;
This code working fine for me...
|
|
|
|
|
I think you know java script is work on client side. I think ajax control will be help you.
|
|
|
|
|
<script type="text/javascript" src="jsfiles/validation.js"></script>
<script type="text/javascript" src="jsfiles/SearchScript.js"></script>
<link rel="stylesheet" href="windowfiles/dhtmlwindow.css" type="text/css" />
<script language="javascript" type="text/javascript" src="windowfiles/dhtmlwindow.js"></script>
<link href="css/jquery-ui.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="jsfiles/jquerymin.js" language="javascript"></script>
<script type="text/javascript" src="jsfiles/jquery-ui.min.js" language="javascript"></script>
<link href="jquery-ui-1817/development-bundle/demos/demos.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" >
$(function () {
var cache = {}, lastXhr;
$("#Grid_RouteDetailCode_ftxtLocationName").autocomplete({
minLength: 1,
source: function (request, response) {
var term = request.term;
if (term in cache) {
response(cache[term]);
return;
}
lastXhr = $.getJSON("GetAutoComplete.aspx?r=" + Math.random() + "&name=" + request.term, request, function (data, status, xhr) {
cache[term] = data;
if (xhr === lastXhr) {
response(data);
}
});
},
select: function (event, ui) {
// document.getElementById("birds").value == ui.item.id;
//var a = ui.item.id;
document.getElementById("locationroute").value = ui.item.id;
// document.getElementById("TextBox1").value = ui.item.id;
//alert(ui.item.id);
}
});
});
|
|
|
|
|
Hello everybody
I have a strange behaviour on an image link with hover image.
When we click and then leave (quickly) the link, the alt is dispayed like if there was no image = alt attribute is displayed, just before new page is openned.
to reproduce :
http://jsfiddle.net/BuETP/1/[^]
click the button and just leave it quicky. "alt" attribute is displayed about 1/2 second...
Can't reproduce it on IE, just in Chrome.
Have you an idea on what i'm doing wrong ? Thanks very much !
|
|
|
|
|
you mean that in pure HTML and JavaScript
<img
src='http://www.html-5.com/images/click-me-normal.png'
alt='alttt'
onmouseenter="javascript:this.src='http://www.html-5.com/images/click-me-hover.png'"
onmouseout="javascript:this.src='http://www.html-5.com/images/click-me-normal.png'"
>
please use attribut TILE too (value of TITLE should be not hte same like value of ALT).
try onmouseover
for IE
onmousedown Fires when the user clicks the object with either mouse button.
onmouseenter Fires when the user moves the mouse pointer into the object.
onmouseleave Fires when the user moves the mouse pointer outside the boundaries of the object.
onmousemove Fires when the user moves the mouse over the object.
onmouseout Fires when the user moves the mouse pointer outside the boundaries of the object.
onmouseover Fires when the user moves the mouse pointer into the object.
onmouseup Fires when the user releases a mouse button while the mouse is over the object.
onmousewheel Fires when the wheel button is rotated.
ALT alt Sets or retrieves a text alternative to the graphic.
SRC src Sets or retrieves a URL to be loaded by the object.
----------------------------------------------------------------------------
<img
id="ImgId"
src='http://www.html-5.com/images/click-me-normal.png'
alt='alttt'
onmouseenter="javascript:ImgOnMouseXXX('ImgId',true);"
onmouseout="javascript:ImgOnMouseXXX('ImgId',false);"
>
var ImgUrlOnMouseover='http://www.html-5.com/images/click-me-hover.png';
var ImgUrlOnMouseout='http://www.html-5.com/images/click-me-normal.png';
function ImgOnMouseXXX(IDOfIMG,state)
// state
// true onmouseover or onmouseenter
// false onmouseout
{
// params are unchecked
var PointerOfIMG;
var SrcOfIMG=ImgUrlOnMouseout; // normal
var PointerOfIMG=document.getElementById(IDOfIMG);
if(PointerOfIMG!=null)
{
if(state){SrcOfIMG=ImgUrlOnMouseover);
PointerOfIMG.src=SrcOfIMG; // need time to request data of img
// if you want check time state use readyState
}
}
for IE
readyState Property Internet Development Index
--------------------------------------------------------------------------------
Retrieves a value that indicates the current state of the object.
Syntax
HTML N/A
Scripting [ sState = ] object.readyState
Possible Values
sState String that receives one of the following values.uninitialized Object is not initialized with data.
loading Object is loading its data.
loaded Object has finished loading its data.
interactive User can interact with the object even though it is not fully loaded.
complete Object is completely initialized.
The property is read-only. The property has no default value.
Remarks
An object's state is initially set to uninitialized, and then to loading. When data loading is complete, the state of the link object passes through
the loaded and interactive states to reach the complete state.
The states through which an object passes are determined by that object; an object can skip certain states (for example, interactive) if the state does not apply to that object.
Data source objects and databound elements are normally populated asynchronously, and certain programmatic operations can only be performed reliably
on databound objects when they are ready for use. Therefore, the appropriate code should be written to confirm the readyState of objects prior to
performing certain operations on them. For example, walking the rows of a table should not be attempted until after the table has reached the complete state.
The readyState property enables the status of an object to be tested. The correct place to test the readyState property is in the event handler for
onreadystatechange. Similarly, a data source object (DSO) fires the ondatasetcomplete event to notify the Web page that the dataset is ready for programmatic operation.
Standards Information
There is no public standard that applies to this property.
Applies To
document, FRAME, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio,
INPUT type=reset, INPUT type=submit, INPUT type=text, LINK, SCRIPT, TABLE, TBODY, TD, TFOOT, TH, THEAD, TR
|
|
|
|
|
I am currently thinking of writing an AutoFill plugin/widget which will take my personal data such as First Name, Last Name etc from a file/javascript and will automatically fill it in web page form. I have read till now to build a plugin which works for all browsers, I have two options:- 1) To make a Jquery UI widget 2) To make a NPAPI plugin
Is there any other easier method to develop an autofilling plugin, and which option to take i.e. NPAPI plugin or Jquery widget ? Thanks
|
|
|
|
|
Hi i am rafiq,
What is the default value of float and double datatype in Java? Its my interview questions could anyone tell me the answer please..
|
|
|
|
|
You would get a better response if you post this question in The Java Forum.
Here is a link that explains all java data types including default values: Data types
|
|
|
|
|
Perhaps your interviewer should have started by asking you the difference between Java[^] and JavaScript. Apart from some vaguely similar syntax, they're completely different things.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
I'm trying to setup a shopping cart form function (add to cart button) which is called via a java script - I have this in a pop-up window and want to have the "add to cart" button both close the pop-up window and also load the info in the main window - anyone know what script modifications I need to have?
here is part of my current code in the pop-up window:
any help would be super!
|
|
|
|
|
If you are having this button in popup, then it would not be possible to get control of main windows once you close this popup right.
So my suggestion would be to have a js file common to both main window and popup.
And have a js function in it to close the child window and then trigger update on main window.
On click of add to cart button, trigger this function.
Hope this should be helpful.
|
|
|
|
|
Thank you for the help - if you had some code that would help me please let me know - thanks
|
|
|
|
|
First thing you'll need is to store the reference of the popup window.
Then you can use it to close the popup and refer to window.location object for updating the page as shown below.
var childWin = window.open(url,name,params)
function closeWindow()
{
childWin.close();
window.location.href = "<new url>";
document.getElementById("divId").innerHTML = "<updated html>";
}
If you want to just update a part of the page, then you can handle it through the DOM objects (document).
|
|
|
|