473,769 Members | 1,637 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pl Check any Error in Javascript Program

144 New Member
Hai Friends,
I have a javascript program , as a snow a single picture will fall from above to below in the browser.It is worked properly when my friend was using.Sudennly it is not working ,pl correct if there is any error and send me............. ..

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2.     <HEAD>
  3.  
  4.         <SCRIPT LANGUAGE="JavaScript">


Expand|Select|Wrap|Line Numbers
  1. var no = 25; // snow number
  2. var speed = 10; // smaller number moves the snow faster
  3. //please put some picture in your computer
  4. var snowflake = "C:\Documents and Settings\Admin\Desktop\jesusinside.gif";
  5.  
  6. var ns4up = (document.layers) ? 1 : 0; // browser sniffer
  7. var ie4up = (document.all) ? 1 : 0;
  8. var dx, xp, yp; // coordinate and position variables
  9. var am, stx, sty; // amplitude and step variables
  10. var i, doc_width = 800, doc_height = 600;
  11. if (ns4up) {
  12. doc_width = self.innerWidth;
  13. doc_height = self.innerHeight;
  14. } else if (ie4up) {
  15. doc_width = document.body.clientWidth;
  16. doc_height = document.body.clientHeight;
  17. }
  18. dx = new Array();
  19. xp = new Array();
  20. yp = new Array();
  21. am = new Array();
  22. stx = new Array();
  23. sty = new Array();
  24. for (i = 0; i < no; ++ i) {
  25. dx[i] = 0; // set coordinate variables
  26. xp[i] = Math.random()*(doc_width-50); // set position variables
  27. yp[i] = Math.random()*doc_height;
  28. am[i] = Math.random()*20; // set amplitude variables
  29. stx[i] = 0.02 + Math.random()/10; // set step variables
  30. sty[i] = 0.7 + Math.random(); // set step variables
  31. if (ns4up) { // set layers
  32. if (i == 0) {
  33. document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
  34. document.write("top=\"15\" visibility=\"show\"><img src=\"");
  35. document.write(snowflake + "\" border=\"0\"></layer>");
  36. } else {
  37. document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
  38. document.write("top=\"15\" visibility=\"show\"><img src=\"");
  39. document.write(snowflake + "\" border=\"0\"></layer>");
  40. }
  41. else if (ie4up)
  42.  {
  43. if (i == 0)
  44.  {
  45. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
  46. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
  47. document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
  48. document.write(snowflake + "\" border=\"0\"></div>");
  49. else 
  50. {
  51. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
  52. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
  53. document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
  54. document.write(snowflake + "\" border=\"0\"></div>");
  55. }
  56. }
  57. }
  58. function snowNS() { // Netscape main animation function
  59. for (i = 0; i < no; ++ i) { // iterate for every dot
  60. yp[i] += sty[i];
  61. if (yp[i] > doc_height-50) {
  62. xp[i] = Math.random()*(doc_width-am[i]-30);
  63. yp[i] = 0;
  64. stx[i] = 0.02 + Math.random()/10;
  65. sty[i] = 0.7 + Math.random();
  66. doc_width = self.innerWidth;
  67. doc_height = self.innerHeight;
  68. }
  69. dx[i] += stx[i];
  70. document.layers["dot"+i].top = yp[i];
  71. document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
  72. }
  73. setTimeout("snowNS()", speed);
  74. }
  75. function snowIE() { // IE main animation function
  76. for (i = 0; i < no; ++ i) { // iterate for every dot
  77. yp[i] += sty[i];
  78. if (yp[i] > doc_height-50) {
  79. xp[i] = Math.random()*(doc_width-am[i]-30);
  80. yp[i] = 0;
  81. stx[i] = 0.02 + Math.random()/10;
  82. sty[i] = 0.7 + Math.random();
  83. doc_width = document.body.clientWidth;
  84. doc_height = document.body.clientHeight;
  85. }
  86. dx[i] += stx[i];
  87. document.all["dot"+i].style.pixelTop = yp[i];
  88. document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
  89. }
  90. setTimeout("snowIE()", speed);
  91. }
  92. if (ns4up)
  93.  {
  94. snowNS();
  95. }
  96.  else if (ie4up)
  97. {
  98. snowIE();
  99. }
Expand|Select|Wrap|Line Numbers
  1.         </SCRIPT>
  2. </head>
  3. </html>
Davidson

8 March 2008
Mar 8 '08 #1
4 1316
acoder
16,027 Recognized Expert Moderator MVP
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

MODERATOR.
Mar 8 '08 #2
acoder
16,027 Recognized Expert Moderator MVP
Hai Friends,
I have a javascript program , as a snow a single picture will fall from above to below in the browser.It is worked properly when my friend was using.Sudennly it is not working ,pl correct if there is any error and send me.
That is very old code. What doesn't work? In which browser?
Mar 8 '08 #3
davidson1
144 New Member
Hai friends it is not working in any browser , pl check and tell me.....sorry for inconvenience.. ............

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <SCRIPT LANGUAGE="JavaScript">
  4. var no = 25; // snow number
  5. var speed = 10; // smaller number moves the snow faster
  6. //put image in ur computer
  7. var snowflake = "C:\Documents and Settings\Admin\Desktop\jesusinside.gif";
  8. var ns4up = (document.layers) ? 1 : 0; // browser sniffer
  9. var ie4up = (document.all) ? 1 : 0;
  10. var dx, xp, yp; // coordinate and position variables
  11. var am, stx, sty; // amplitude and step variables
  12. var i, doc_width = 800, doc_height = 600;
  13. if (ns4up) {
  14. doc_width = self.innerWidth;
  15. doc_height = self.innerHeight;
  16. } else if (ie4up) {
  17. doc_width = document.body.clientWidth;
  18. doc_height = document.body.clientHeight;
  19. }
  20. dx = new Array();
  21. xp = new Array();
  22. yp = new Array();
  23. am = new Array();
  24. stx = new Array();
  25. sty = new Array();
  26. for (i = 0; i < no; ++ i) {
  27. dx[i] = 0; // set coordinate variables
  28. xp[i] = Math.random()*(doc_width-50); // set position variables
  29. yp[i] = Math.random()*doc_height;
  30. am[i] = Math.random()*20; // set amplitude variables
  31. stx[i] = 0.02 + Math.random()/10; // set step variables
  32. sty[i] = 0.7 + Math.random(); // set step variables
  33. if (ns4up) { // set layers
  34. if (i == 0) {
  35. document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
  36. document.write("top=\"15\" visibility=\"show\"><img src=\"");
  37. document.write(snowflake + "\" border=\"0\"></layer>");
  38. } else {
  39. document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
  40. document.write("top=\"15\" visibility=\"show\"><img src=\"");
  41. document.write(snowflake + "\" border=\"0\"></layer>");
  42. }
  43. else if (ie4up)
  44.  {
  45. if (i == 0)
  46.  {
  47. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
  48. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
  49. document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
  50. document.write(snowflake + "\" border=\"0\"></div>");
  51. else 
  52. {
  53. document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
  54. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
  55. document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
  56. document.write(snowflake + "\" border=\"0\"></div>");
  57. }
  58. }
  59. }
  60. function snowNS() { // Netscape main animation function
  61. for (i = 0; i < no; ++ i) { // iterate for every dot
  62. yp[i] += sty[i];
  63. if (yp[i] > doc_height-50) {
  64. xp[i] = Math.random()*(doc_width-am[i]-30);
  65. yp[i] = 0;
  66. stx[i] = 0.02 + Math.random()/10;
  67. sty[i] = 0.7 + Math.random();
  68. doc_width = self.innerWidth;
  69. doc_height = self.innerHeight;
  70. }
  71. dx[i] += stx[i];
  72. document.layers["dot"+i].top = yp[i];
  73. document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]);
  74. }
  75. setTimeout("snowNS()", speed);
  76. }
  77. function snowIE() { // IE main animation function
  78. for (i = 0; i < no; ++ i) { // iterate for every dot
  79. yp[i] += sty[i];
  80. if (yp[i] > doc_height-50) {
  81. xp[i] = Math.random()*(doc_width-am[i]-30);
  82. yp[i] = 0;
  83. stx[i] = 0.02 + Math.random()/10;
  84. sty[i] = 0.7 + Math.random();
  85. doc_width = document.body.clientWidth;
  86. doc_height = document.body.clientHeight;
  87. }
  88. dx[i] += stx[i];
  89. document.all["dot"+i].style.pixelTop = yp[i];
  90. document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]);
  91. }
  92. setTimeout("snowIE()", speed);
  93. }
  94. if (ns4up)
  95.  {
  96. snowNS();
  97. }
  98.  else if (ie4up)
  99. {
  100. snowIE();
  101. }
  102. </SCRIPT>
  103. </HEAD>
  104. </html>
  105.  

Davidson
9 March 2008
Mar 9 '08 #4
acoder
16,027 Recognized Expert Moderator MVP
Nice try with the code tags. Unfortunately, you used <code> instead of [code]. The code tags are enclosed using square brackets.
Hai friends it is not working in any browser , pl check and tell me.....sorry for inconvenience.
What errors do you see? Check the error console.

As I said, this is old code. If you've not written this, I would suggest finding a newer version that works in modern browsers.
Mar 9 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1847
by: Axel Foley | last post by:
Hi Folks, i'm newbie at JS; but "learning by tweaking" is my middle name! Trying to set up a link partnership application on a client's site; got this script at "The Javascript Source", but it does not work for me. If anyone would be so kind as to comb it for apparent flaws, I would be greatly indebted! My <form> statement includes the following:... onSubmit="return
1
3759
by: vncntj | last post by:
i want to enable one listbox and disable the other depending on if i check winter_gala (checkbox) here is my code. <script type="text/javascript"> function check() { if (document.forms.winter_gala.checked=true) { document.forms.winter_gala.young_friend_list.disabled=true
25
29762
by: pamelafluente | last post by:
Hi Guys, I have the following HTML code which is doing a GET to a page, say MyUrl.aspx : <body> <form name="form1" method="get" action="MyUrl.aspx" id="form1"> <input type="hidden" name="ClickedElement" id="Messenger" /> </form> </body>
19
108018
Frinavale
by: Frinavale | last post by:
Filtering user input is extremely important for web programming. If input is left unfiltered users can input malicious code that can cripple your website. This article will explain how to make sure that the user only submits a number to your .NET web application and also demonstrate how to add JavaScript to your ASPX pages. Upon popular demand, I have added a section that also covers how to use a validator control to check if a text box...
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.