Jump to content

Leon

Members
  • Content Count

    18
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Leon

  • Rank
    Newbie
  1. Hi im new to css. Im trying to get the nav bar into the center of the header image. For some reason im following the tutorial online step by step and still doesnt work. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Nav Bar and Header</title> <link rel="stylesheet" type="text/css" href="navbar.css"/> </head> <body> <div id="nav"> <div id="nav_wrapper"> <br> <ul> <li><a href="#">Home Menu</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> </ul> </div> </div> </body> </html> This is my code。 if code was written : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Nav Bar and Header</title> <link rel="stylesheet" type="text/css" href="navbar.css"/> </head> <body> <div id="nav"> <li><a href="#">Home Menu</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> <div id="nav_wrapper"> <br> <ul> <li><a href="#">Home Menu</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> </ul> </div> </div> </body> </html> it will happen image one. Is there a way to move the
  2. the most importantly it was "start=setInterval("start()",400);" i have to change it to go=setInterval("turn()",400); this is the part where i ignored. im sorry for wasting your time. But thankyou for everything
  3. the most importantly it was "start=setInterval("start()",400);" i have to change it to go=setInterval("turn()",400); thanks
  4. well, i can always rename to var start as var go for example : this is how i look at the code
  5. im just following my professor example. THATS WHY IM CONFUSE.. var start doesnt have a declare but it works but var go doesnt ...
  6. sorry for saying this but i did compare it ... i still dont see it... can u point out the code for me ..
  7. which one it works ? the one with var start; ? if the one with var start; works then why wouldnt the one with var go; doesnt work ? They are identical.
  8. a variable that has no value applied to it? can you show me an example ? please?
  9. i have been debugging all night, and i couldnt find the outcome
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <script language="javascript"> var smile = new Array(6); var rotate=0; var start; smile [0]= new Image(); smile [0].src="smile0.jpg"; smile [1]= new Image(); smile [1].src="smile1.jpg"; smile [2]= new Image(); smile [2].src="smile2.jpg"; smile [3]= new Image(); smile [3].src="smile3.jpg"; smile [4]= new Image(); smile [4].src="smile4.jpg"; smile [5]= new Image(); smile [5].src="smile5.jpg"; function turn(){ if(rotate==5) rotate=0; else ++rotate; document.smile.src=smile[rotate].src; } function turningpoint() { if (start) clearInterval(start); start=setInterval("turn()",400); } </script> <p><img src="smile0.jpg" name="smile"/> </p> <form> <input type="button" name="run" value=" Run " onclick="turningpoint();"/> <input type="button" name="Stop" value=" Stop " onclick="clearInterval(start);"/> </form> </body> </html> I am trying to do a debug on this code but i cant find any errors. I have a few questions about this code. 1) "Sometime it works on desktop but not on expression web. 2) when i rename It has nothing to do with ''var Start" to other names it doesnt work. The stop button doesnt work. For example : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <script language="javascript"> var smile = new Array(6); var rotate=0; var begin; smile [0]= new Image(); smile [0].src="smile0.jpg"; smile [1]= new Image(); smile [1].src="smile1.jpg"; smile [2]= new Image(); smile [2].src="smile2.jpg"; smile [3]= new Image(); smile [3].src="smile3.jpg"; smile [4]= new Image(); smile [4].src="smile4.jpg"; smile [5]= new Image(); smile [5].src="smile5.jpg"; function turn(){ if(rotate==5) rotate=0; else ++rotate; document.smile.src=smile[rotate].src; } function turningpoint() { if (begin) clearInterval(begin); start=setInterval("turn()",400); } </script> <p><img src="../5/smile0.jpg" name="smile"/> </p> <form> <input type="button" name="run" value="Run" onclick="turningpoint();"/> <input type="button" name="Stop" value="Stop" onclick="clearInterval(begin);"/> </form> </body> </html> OR when i rename function turn() to function start() the run button doesnt function <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <script language="javascript"> var smile = new Array(6); var rotate=0; var go; smile [0]= new Image(); smile [0].src="smile0.jpg"; smile [1]= new Image(); smile [1].src="smile1.jpg"; smile [2]= new Image(); smile [2].src="smile2.jpg"; smile [3]= new Image(); smile [3].src="smile3.jpg"; smile [4]= new Image(); smile [4].src="smile4.jpg"; smile [5]= new Image(); smile [5].src="smile5.jpg"; function start(){ if(rotate==5) rotate=0; else ++rotate; document.smile.src=smile[rotate].src; } function turningpoint() { if (go) clearInterval(go); start=setInterval("start()",400); } </script> <p><img src="../5/smile0.jpg" name="smile"/> </p> <form> <input type="button" name="run" value="Run" onclick="turningpoint();"/> <input type="button" name="Stop" value="Stop" onclick="clearInterval(go);"/> </form> </body> </html>
  11. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <script language="javascript"> var smile = new Array(6); var rotate=0; var start; smile [0]= new Image(); smile [0].src="smile0.jpg"; smile [1]= new Image(); smile [1].src="smile1.jpg"; smile [2]= new Image(); smile [2].src="smile2.jpg"; smile [3]= new Image(); smile [3].src="smile3.jpg"; smile [4]= new Image(); smile [4].src="smile4.jpg"; smile [5]= new Image(); smile [5].src="smile5.jpg"; function turn(){ if(rotate==5) rotate=0; else ++rotate; document.smile.src=smile[rotate].src; } function turningpoint() { if (start) clearInterval(start); start=setInterval("turn()",400); } </script> <p><img src="smile0.jpg" name="smile"/> </p> <form> <input type="button" name="run" value=" Run " onclick="turningpoint();"/> <input type="button" name="Stop" value=" Stop " onclick="clearInterval(start);"/> </form> </body> </html> 10.html
  12. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="en-us" http-equiv="Content-Language" /> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 1</title> </head> <body> <form name="checkmail" onSubmit="return checkemail()" method="post" action="javascript:alert('The form is submitted!!!')"> Please enter your email<br /> <input name="Text1" type="text" /> <input name="Button1" type="submit" value="submit" /> </form> <script language="javascript" > function checkemail(){ var email=document.checkmail.Text1.value; if (email.indexOf(' ')==-1 && 0 < email.indexOf('@') && email.indexOf('@')+5< email.length )return true; else alert('Invalid Email address') return false; } </script> </body> </html> if (email.indexOf(' ')==-1 && 0 < email.indexOf('@') && email.indexOf('@')+5< email.length )return true; else alert('Invalid Email address') return false; } Can someone tell me what does this part of code do? i have look through w3cschool and i dont understand.
  13. 1) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 2</title> </head> <body> <p>Current Time</p> <p id="CurrentTime"></p> <script> var myVaribale=setInterval(thetimeisnow,1000); function thetimeisnow(){ var y=new Date(); document.getElementById("CurrentTime").innerHTML=y; } </script> </body> </html> 2) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Untitled 2</title> </head> <body> <p>Current Time</p> <p id="CurrentTime"></p> <script> var myVaribale=setInterval(thetimeisnow,1000); function thetimeisnow(){ var y=new Date(); document.getElementById("CurrentTime").innerHTML=y.toLocaleDateString(); } </script> </body> </html> "The first code, i can display time and date but idk how to change the time zone. The second one if i include "toLocaleDateString();"it will be display only date not the time.. if without"toLocaleDateString();" it will display the output on the first image can someone tell me why? "
  14. LOL i got too excited that i had it works, forgot to copy the last two tags <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Cmftin</title> </head> <body> <h1>This method will change metric to standard.</h1> <form action="" name="centimeter" > Centimeter<input type="text" name="cm" value="0" /> Feet<input type="text" name="ft" value="0" /> Inch<input type="text" name="in" value="0" /> </form> <input name="Button1" type="button" value="convert" onclick="crtcm2ftin ()" /> <script type="text/javascript"> function crtcm2ftin (){ var cm= parseInt(document.centimeter.cm.value); if (cm > 0){ var ft= (cm/30.48); document.centimeter.ft.value=ft; var inch = (cm/2.54); document.centimeter.in.value=inch; } } /*Leon*/ </script> <p> </p> </body> </html>
  15. Ty so much , u helped me a lot. This is my final code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><title>Cmftin</title></head><body><h1>This method will change metric to standard.</h1><form action="" name="centimeter" >Centimeter<input type="text" name="cm" value="0" />Feet<input type="text" name="ft" value="0" />Inch<input type="text" name="in" value="0" /></form><input name="Button1" type="button" value="convert" onclick="crtcm2ftin ()" /><script type="text/javascript">function crtcm2ftin (){var cm= parseInt(document.centimeter.cm.value);if (cm > 0){var ft= (cm/30.48);document.centimeter.ft.value=ft;var inch = (cm/2.54);document.centimeter.in.value=inch; }}</script><p> </p>
×
×
  • Create New...