473,387 Members | 1,416 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help with logic

This is my code. Its an art project that I am doing as a hobby however I am a little stuck.

Basically the program counts through unicode characters by using a set timeout feature similar to what you would use for a clock.

The only problem is that many of the entries are blank so I wanted to write a series of if statemtns that would eliminate the blank spaces based on analysis. For example the counter does nothing till the 12th increment then it shows a symbol. I am trying to make some code to eliminate the blanks but I cant figure out what to do. I commented where I am having trouble.




Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. var c=0;
  5.  
  6. var t;
  7.  
  8.  
  9. function timedCount()
  10. {
  11.  
  12.  
  13. String.fromCharCode(c)
  14.  
  15. document.getElementById('txt').value=String.fromCharCode(c);
  16. document.getElementById('text').value=c; 
  17.  
  18.  
  19. //This is the problem area every time I try if statements it doesnt work.
  20.  
  21. c = c+1;
  22. d=(d+1);
  23. e=(e+1);
  24. t=setTimeout("timedCount()",1000);
  25.  
  26.  
  27.  
  28.  
  29.  
  30. }
  31.  
  32.  
  33.  
  34. function stopCount()
  35. {
  36. clearTimeout(t);
  37. }
  38.  
  39.  
  40.  
  41.  
  42. function resetC()
  43.  c=10;
  44.  reset();
  45.  
  46.  
  47. }
  48. </script>
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. <style type="text/css">
  62.  
  63. .style1 {
  64.    font-family: ;
  65.  
  66.    font-size: 60px;
  67.    color: rgb(0,100,175);
  68.    background-color: #FFFFCC;
  69.    padding: 2px;
  70.    height: 80px;
  71.    width: 100px;
  72.    border: 1px solid #7F9DB9;
  73. }
  74.  
  75. .style2 {
  76.    font-family: ;
  77.    font-size: 60px;
  78.    color: rgb(0,100,175);
  79.    background-color: #FFFFCC;
  80.    padding: 2px;
  81.    height: 80px;
  82.    width: 300px;
  83.    border: 1px solid #7F9DB9;
  84. }
  85.  
  86.  
  87.  
  88.  
  89. </style>
  90.  
  91.  
  92.  
  93.  
  94. </head>
  95.  
  96. <body>
  97. For God (the Primary Maker of the Good Place Beyond this life)
  98. <br></br>
  99. <form>
  100. <input type="button" value="Start Count" onClick="timedCount()">
  101.  
  102.  
  103. <input type="text" class="style1" id='txt'><br></br>
  104.  
  105. <input type="button" value="Stop count!" onClick="stopCount()">
  106. <input type="button" value="reset" onClick="resetC()">
  107. <input type="text" class="style2" id='text'>
  108.  
  109.  
  110.  
  111. </form>
  112.  
  113. <br></br>
  114. <br></br>
  115. <br></br>
  116. <p>Click on the button above. The the imput will start counting throgh various unicode characters.</p>
  117. </body>
  118.  
  119. </html>
Nov 17 '08 #1
3 1102
RamananKalirajan
608 512MB
Sir, can u please tell me what is the purpose of the variable "d" u havent define it in the code

Regards
Ramanan Kalirajan
Nov 17 '08 #2
Well D and E in crements are there incase I want to because I want to make I am planning the output more than one character 3 to be exact. So for now they are just lett there. I though I eliminated them from the post my apologies.
Nov 17 '08 #3
RamananKalirajan
608 512MB
Well D and E in crements are there incase I want to because I want to make I am planning the output more than one character 3 to be exact. So for now they are just lett there. I though I eliminated them from the post my apologies.

Hello, I tried to print the values inside the quotes it is printing some value, you are not getting null values, instead u are getting some spaces. Try the below code

[HTML]<html>
<head>
<script type="text/javascript">
var c=0;
var t;
function timedCount()
{
String.fromCharCode(c);
document.getElementById('txt').value="\' "+String.fromCharCode(c)+" \'";
document.getElementById('text').value=c;
//This is the problem area every time I try if statements it doesnt work.
c = c+1;
//d=(d+1);
//e=(e+1);
t=setTimeout("timedCount()",1000);
}
function stopCount()
{
clearTimeout(t);
}
function resetC()
{
c=10;
reset();
}
</script>

<style type="text/css">
.style1 {
font-family: ;

font-size: 60px;
color: rgb(0,100,175);
background-color: #FFFFCC;
padding: 2px;
height: 80px;
width: 100px;
border: 1px solid #7F9DB9;
}

.style2 {
font-family: ;
font-size: 60px;
color: rgb(0,100,175);
background-color: #FFFFCC;
padding: 2px;
height: 80px;
width: 300px;
border: 1px solid #7F9DB9;
}
</style>
</head>

<body>
For God (the Primary Maker of the Good Place Beyond this life)
<br></br>
<form>
<input type="button" value="Start Count" onClick="timedCount()">
<input type="text" class="style1" id='txt'><br></br>
<input type="button" value="Stop count!" onClick="stopCount()">
<input type="button" value="reset" onClick="resetC()">
<input type="text" class="style2" id='text'>

</form>
<br></br>
<br></br>
<br></br>
<p>Click on the button above. The the imput will start counting throgh various

unicode characters.</p>
</body>

</html>[/HTML]

If u want to avoid those things to be displayed u can very well use some js comparison method before printing the value inside the text box. If u need more help just post it in the forum i will try to help u out

Regards
Ramanan Kalirajan.
Nov 18 '08 #4

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

Similar topics

6
by: Jack Smith | last post by:
Help needed on this question. Any help is appreciated. Thanks in advance. Given a binary string (i.e. a finite sequence of 0's and 1's) we choose any two digit substring 01 and replace it by a...
3
by: Mike | last post by:
Hey guys I am pulling my hair out on this problem!!!!! Any help or ideas or comments on how to make this work I would be grateful! I have been working on this for the past 4 days and nothing I do...
7
by: Jack Addington | last post by:
I've got a fairly simple application implementation that over time is going to get a lot bigger. I'm really trying to implement it in a way that will facilitate the growth. I am first writing a...
9
by: Jack Addington | last post by:
I have a base form and a base logic class. Each has to know of the other. I'm then inheriting to create descendant form and descendant logic which extend both objects and again have to know of...
7
by: Stephen | last post by:
I have some code which I call from a custom validator however I seem to have got the logic wrong and im having trouble figuring out how to write my code to get things to work the way I require....
11
by: ricolee99 | last post by:
Hi everyone, I'm trying to invoke my .exe application from a remote server. Here is the code: ManagementClass processClass = new ManagementClass ("\\\\" +"RemoteServerName" +...
4
by: John Sitka | last post by:
Hi, sorry for a crosspost but that other news group was showing last post was a week ago so I guess it dosen't see much use... I'm about to start a solution and I'm curious about the approach of...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
5
by: Burt | last post by:
There's an architect at my 200 person company that advocates having many layers in all my C# apps. He wants web services, use case handlers, facade layers, data gateways, etc. When I ask why all...
9
by: SAL | last post by:
Hello, I have a Dataset that I have table adapters in I designed using the designer (DataLayer). I have a business logic layer that immulates the DataLayer which may/may not have additional logic...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.