|
Graham Breach wrote: Running it in the IE9 debugger I found that the "complete" member of the current image was false when the script fails. So the browser hasn't loaded the relevant image before trying to draw it.
Is there a way to wait until complete is true before continuing with processing? I got the background image from someone else, and neglected to post-process the background image so that it was a reasonable size on disk. Maybe doing that will fix it...
Graham Breach wrote: I managed to get the page to work in Opera by changing both occurrences of
context.drawImage(collection[i].OnImage.ItemImage, collection[i].ImageX, collection[i].ImageY);
to
context.setTransform(1, 0, 0, 1, collection[i].ImageX, collection[i].ImageY);
context.drawImage(collection[i].OnImage.ItemImage, 0, 0);
I don't know why that should make any difference though.
I wonder why that would even matter...
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I have it working in IE9 now - the problem wasn't the images taking too long to load, it was looking in the wrong place for them.
The contents of the XML node is not in a "textContent" member in IE9, it is in "text" instead, so I've changed the parseConfigNodes function like this:
if (child.tagName == "ImageFolder")
{
_cfgImageFolder = (child.text || child.textContent) + "/";
}
else if (child.tagName == "PetPicsFolder")
{
_cfgPetsFolder = (child.text || child.textContent) + "/";
}
This should do the trick unless the folder name happens to be falsy.
|
|
|
|
|
I was reading up on javascript this morning, and found something called modernizr. Would that have helped in this situation?
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I don't think it would have helped in this case, no. These are just a couple of the typical cross-current-browser problems that come and go.
|
|
|
|
|
I also ran process explorer, and firefox slowly increases in memory consumption when that page is displayed. Is that just firefox being firefox, or is that the result of my crappy javascript?
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
Just Firefox I expect - the Chrome debugger heap snapshots don't show any change in memory use, so I wouldn't worry about that.
Processor use is quite high on my PC though - completely redrawing 6-10 large canvases 50 times a second is a bit intensive. Canvases that don't change only need to be drawn once as they are buffered offscreen.
If you don't intend to move the static canvases in relation to each other you can draw them all on one canvas, which saves memory too.
|
|
|
|
|
I took your advice and combined all of the static layers into a single one. It loads much faster. I also applied your changes to make IE work, but success with Opera still eludes me. I'm gonna go at it again in the morning before I go to work. Another plus is that it still works on the browsers it already worked on.
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I know this is a dated post, but nonetheless;
FireFox's JS garbage collector has always been notoriously bad ad releasing resources, particularily when using closures or anonymous functions. Without looking at the code that would be my guess as to what was happening there.
//L
|
|
|
|
|
I worked on a web page years ago and discovered that images load asynchronously, so I had to resort to tactics I used when I was doing real time computer controlled conveyor systems in that each image load event would set a flag stating it was loaded and called a common routine to determine if all the images (flags set) were loaded before calling the processing routine.
After I did that, my problems went away.
Psychosis at 10
Film at 11
Those who do not remember the past, are doomed to repeat it.
Those who do not remember the past, cannot build upon it.
|
|
|
|
|
The background is 602k - jeezus... I'll fix that when I get home. No reason it couldn't be closer to 150k...
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I got it working in Opera AND IE!
I also had to call setTransform before when I cleared a context.
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
I just realized I may not have expressed my gratitude for your help. Many thanks, oh great and powerful Oz.
".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 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
OUTSIDE the environment
running it from inside a folder inside mydocuments...
the first warning notice is that active x restricted content wants to run.
Clicked on allow it to run...
Pops up an error on line 162 (access denied)
enabled the debugger and the debugger shows its halted at...
request.open("GET", "treeofhope.xml", false);
looking at the request object properties it shows error number -2147483638
and just a white screen after that.
I suspect that the XML file has not fully loaded and maybe thats what given me a white screen?
Seems to run fine in the development environment on mine though, a completely different story here..... no problems what so ever.
If anything there seems to be a pause of around 1.5 second when the christmas tree lights are doing nothing but thats about it.
I'm running IE 9.0.8112 and Win 7 64bit
|
|
|
|
|
I wonder what version of opera you guys are running as on my opera 12.12 its the same as in IE9 white screen.
|
|
|
|
|
How can catch the exceptions if my parent and child pages are from different domains.
My agenda is to:
load content using iframes from a cross domain. If the loading fails, catch the exception and retry. If the retry fails too, catch the exception and throw exception.
I know it's easy to do it if the parent and child are from same domain.
Please help!!! Thanks in advance
|
|
|
|
|
Hello everyone,
I'm searching for a way to do a overlay with a loading indicator cover only 1 div on the page.
the reason i want to do this is that i'll have multiple sections in my pages that will do ajax calls to the server to get data and display in fields, most will be calculation results, so i don't want to replace the div's content, just the field value.
in my searchs, i only found solutions for overlays that cover the entire screen, that's good, but i want the rest of the page to be accessible while the ajax request goes on the background.
right now, i've the following code to create a overlay:
var lockOverlayHtml = '<div class="overlayDiv"></div>';
var lockElement = (function (container) {
var element = $(container);
var overlay = $(lockOverlayHtml);
overlay.offset(element.offset());
overlay.height(element.outerHeight(false));
overlay.width(element.outerWidth(false));
overlay.appendTo(document.body);
});
problem is, i can't think in a way to remove only this overlay when the ajax request ends, as it can be used to cover any element on the screen and i can have multiple ones at a time.
what can i use to identify this overlay and remove it?
i thought in something like generating a id using the coordinates, is it a good idea?
also, don't know if i can ask this here, but the overlayDiv class looks like this:
.overlayDiv
{
position: absolute;
opacity: 0.5;
z-index: 1000;
background-color: #606060;
}
this will work even when the browser scrolls? or i need to do something else in that case?
I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p)
|
|
|
|
|
I am showing a multi column table in OnClientShowing event of AutoComplete extender based on the return value (The value is concatenated with | delimeter) from the service method.
While creating dynamic table the TD element is created with value of the code and table display is name.
When user clicks on the blank space the table the OnClientShowing shows the correct value in eventArgs.get_value() but when user clicks on the text area of Table the eventArgs.get_value() returns NULL.
eventArgs.get_text() returns the the name displayed in the table but name is of no use to me. I need TD value. How can I get it.
|
|
|
|
|
please help me to write ...
A) Write the code for the login.html document (Client side) which gives the following interface. When the user clicks on the button you must check if the user enters data or not, if the fields are empty you must present an alert message and do not send the data to the server side. If the user entered login and password, then your program must call the validate.php document.
B) Write the code of the server side validate.php page such that.
1) The validate.php checks if the login is valid or not. A valid login must
start with a letter and followed by any one or more of the characters:_, 0-9, A-Z, a-z
For instance, a1, ab_1, and Z_2d are valid logins while _a1, b*, and
c23_@2 are invalid logins. But, there are no restrictions on the password; the user
can use any character in the keyboard. (hint. You must use the regular expression
in php).
2) The validate.php page reads the login and passwords from a database
named"students" to verify whether the student is a valid user. The "students"
database contains two tables named "login_pssword" and “marks”. The
login_pssword table has three fields “Student_Id”,"login" and"password”.
Check if the user name and passwords exist. If it exists print the message
"Thank you for logging in". If the password or login is not in the database,
display the alert message "wrongpassword and/or login please try again".
The “marks” table has five fields: student_Id, course_name, first_mark,
second_mark, Final_mark.
3)if a valid user logged in, give him/her two choices:
1. Add a new student
2. Remove a student
Design two different forms, one for each choice above to enable the student to perform the choice he/she selected.
the header code :-
<html> <head> <script type = "text/javascript">
Function validate(){
Winow.event.returnvalue = false;
If ((f1.login.value == "") || (f1.password.value ==""))
alert("you must enter your name and password");
else
window.event.returnvalue = true;
}
</script> </head> <body>
<form id ="f1" action = "validate.php" method = "post" onsubmit ="validate()">
User Name <input type ="text" name = "login"/> <br />
Password <input type ="password" name ="password"/> <br />
<input type = "submit" value ="login"/>
</form> </body> </html>
|
|
|
|
|
Here is the complete code without ajax functionality. You didn't mention in the question if you wanted to display result without loading the php page.The login.html could looks like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type = "text/javascript">
function validate(){
if((f1.login.value == "") || (f1.password.value == ""))
{
alert("you must enter your name and password");
return false;
}
else
{
return true;
}
}
</script>
</head>
<body>
<form id ="f1" action = "validate.php" method="post" onsubmit ="return validate(this);">
User Name <input type ="text" name = "login"/> <br />
Password <input type ="password" name ="password"/> <br />
<input type = "submit" value ="login"/>
</form>
</body>
</html>
The validate.php could look like this:
<?php
$userName = $_REQUEST["login"];
$userPassword = $_REQUEST["password"];
if(preg_match("/^[a-zA-Z][a-zA-Z0-9_]+$/", $userName, $matches) )
{
CheckWithDatabase($userName,$userPassword);
}
function CheckWithDatabase(&$usr, &$pw)
{
mysql_connect("localhost", "userleon", "Pa55word") or die(mysql_error());
mysql_select_db("students") or die(mysql_error());
$data = mysql_query("SELECT login, password FROM login_password") or die(mysql_error());
while($info = mysql_fetch_array( $data ))
{
if( ($usr == $info['login']) && ( $pw == $info['password'] ))
{
echo "Thank you for logging in";
echo "<form><input type=\"radio\" name=\"choice\" value=\"Add a new student\">Add a new student<br/><input type=\"radio\" name=\"choice\" value=\"Remove a student\"/>Remove a student</form>";
}
else
{
echo "<a href=\"javascript:history.go(-1)\">GO BACK</a>";
echo "<script type=\"text/javascript\">alert(\"wrongpassword and/or login please try again\");</script>";
}
}
}
?>
Hope it answers your question
follow me on twitter @leon_developer
modified 25-Nov-12 20:15pm.
|
|
|
|
|
Well done, you just did this guy's homework for him. Or worse, this guy is actually a paid programmer and you just did his work for which he's getting paid.
|
|
|
|
|
I am new here.How else should I answer questions?
|
|
|
|
|
Look for ones which are BLATANT homework or "send me codez im clueless", and move on to the next one.
|
|
|
|
|
Being new here and with good knowledge to help people is great and we welcome you to the community.
Like mentioned already by Jamie, we don't like blatant homework answers to be answered with complete code answers like you gave here. The reason is that we want the students who come here for help to learn how to develop things properly. No one learns anything when a blatant gimme-codez homework question is answered in full as you have. The OP is simply going to copy/paste your solution as their homework solution, get the marks, and learn nothing about the process of arriving at that solution. If you are already a professional developer, would you like to hire this individual to work with/for you? I doubt it and I know I don't want to. The way to answer questions like this if you feel so compelled is to lead them down the right path to a solution while still getting them to make the decisions and write the code necessary. That way every one is a winner. Again, cheers and welcome to CP.
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Leon Munir ... thanks 4 u
|
|
|
|
|
Hi!
This has been bugging me for quite a while now... I have done many google searches but nothing seems to actually help me.... When i run this script i get the following error:
"SCRIPT5007: Unable to set value of the property 'onmouseover': object is null or undefined"
I don't know how it doesn't work but if i use onmouseover="show()" and obviosuly remake my function heading it works... I can't use the onmouseover="" as apparently its not the best way of doing it... Cna nayone shine some light on where it could be going wrong? Thanks for all your help!
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
#gallery
{
position:relative;
display:block;
width:800px;
height:500px;
margin:20px auto;
text-align:center;
}
#image
{
display:block;
width:800px;
height:500px;
}
#imgBar
{
position:absolute;
display:block;
width:500px;
height:80px;
z-index:2;
top:400px;
left:145px;
display:none;
}
</style>
<script>
var galleryImg = document.getElementById('image');
var bar = document.getElementById('imgBar');
galleryImg.onmouseover = function ()
{
bar.style.display = "block";
};
galleryImg.onmouseout = function ()
{
bar.style.display = "none";
};
</script>
</head>
<body>
<section id="gallery">
<img src="#" id="image"/>
<div id="imgBar">
<img src="img/gallery/thumbnail1.png" class="thumbnail"/>
<img src="img/gallery/thumbnail1.png" class="thumbnail"/>
<img src="img/gallery/thumbnail1.png" class="thumbnail"/>
<img src="img/gallery/thumbnail1.png" class="thumbnail"/>
</div>
</section>
</body>
</html>
|
|
|
|
|