Jump to content

Bojak

Members
  • Posts

    57
  • Joined

  • Last visited

Everything posted by Bojak

  1. <HTML> <head> <title>Last Visit Cookie Tester</title> <script type='text/javascript'> function myFunction() { var currentDate = new Date(); var dateTime = (currentDate.getMonth()+1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear(); document.write("Current Date: " + dateTime); document.write("<br>"); document.write("<br>"); document.write("<br>"); document.cookie = dateTime; var lastVisit = document.cookie; document.write("Last Visit: " + lastVisit); } if (dateTime !=="") { document.write("window.dateTime"); alert("Passed! you are awesome!"); else { alert("failed. try again!"); } } </script> </head> <body> <div id="showDate" style="display:none; " > <script type="text/javascript"> myFunction(); </script> </div> <div style="position:absolute; top:20px; left:20px;"> <a href="#" onclick="document.getElementById('showDate').style.display = 'block';"> Show Date </a> </div> </body> </HTML> my if statement isnt working properly. i want to parse the information if the cookie isnt null. guidiance would help so much!
  2. Bojak

    CSS wont display

    i like the last visit idea. thats exactly my goal. i was working on a cookie to store that. the issue its still above the hyperlink
  3. div #showDate { position:absolute;41px;top:20px; <HTML> <head> <link type="text/css" href="displayDate.css" /> <script type='text/javascript'> function myFunction() { var currentDate = new Date(); var dateTime = (currentDate.getMonth()+1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear(); document.write(dateTime); //document.getElementById('currentDate').innerHTML = dateTime; Document.cookie = dateTime; document.write(lastVisit); Var lastVisit = document.cookie; } </script> </head> <body> <div id="showDate" style="display:none"> <script type="text/javascript"> myFunction(); </script> </div> <a href="#" onclick="document.getElementById('showDate').style.display = 'block';"> Show Date </a> </body> </HTML> i cant make the date display below the hyperlink. when i tried the above codes the date doesnt appear at all. suggestions?
  4. <HTML> <head> <script type='text/javascript'> function myFunction() { var currentDate = new Date(); var dateTime = (currentDate.getMonth()+1) + "/" + currentDate.getDate() + "/" + currentDate.getFullYear(); document.write(dateTime); //document.getElementById('currentDate').innerHTML = dateTime; } </script> </head> <body> <div id="showDate" style="display:none"> <script type="text/javascript"> myFunction(); </script> </div> <a href="#" onclick="document.getElementById('showDate').style.display = 'block';"> Show Date </a> </body> </HTML> yeah i experimented and tried that after i posted. it worked beautifully. I guess I am a little OCD when it comes to certain things. I am working setting up a cookie now. do i call myFunction to setup the cookie? im not new to scripting but i still have trouble learning how to do things. i usually break more than i fix things lol.
  5. how do you switch it so that its month/day/year ?
  6. i tried making the cookie i failed badly lol. i shall try again i guess!
  7. well im using the cookie to save the date and time. so when i go back to that page the date is still there. im creating a search engine and i wanted to add this as a feature.
  8. would taking out false allow me to go to the link and keep the date under it? i think i may need to set a cookie to save the date as well. just so you know it wasnt a copy and paste job i was typing it out on my phone. thats why i had so many errors.
  9. <!DOCTYPE html > <head> <script> function myFunction() { var currentDate = new Date(); var dateTime = currentDate.getDay() + “/“ + currentDate.getMonth() + “/“ + currentDate.GetFullYear(); } </script> </head> <body> <a href =“myPage.html” onclick="myFunction">test</a> </body> </html> this code isnt posting the date under the link. i cant seem to make the date add at all. the href works though. any suggestions?
  10. <!DOCTYPE html> <html> <head> <style type="text/css"> div#video_player_box{ width:550px; background:#000; margin:0px auto; } div#video_controls_bar{ background: #333; padding:10px; color:#CCC; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; } button#playpausebtn{ background:url(pause.png); border:none; width:16px; height:18px; cursor:pointer; opacity:0.5; } button#playpausebtn:hover{ opacity:1; } input#seekslider{ width:180px; } input#volumeslider{ width: 80px; } input[type='range'] { -webkit-appearance: none !important; background: #000; border:#666 1px solid; height:4px; } input[type='range']::-webkit-slider-thumb { -webkit-appearance: none !important; background: #FFF; height:15px; width:15px; border-radius:100%; cursor:pointer; } </style> <script> var vid, playbtn, seekslider, curtimetext, durtimetext, mutebtn, volumeslider, fullscreenbtn; function intializePlayer(){ // Set object references vid = document.getElementById("my_video"); playbtn = document.getElementById("playpausebtn"); seekslider = document.getElementById("seekslider"); curtimetext = document.getElementById("curtimetext"); durtimetext = document.getElementById("durtimetext"); mutebtn = document.getElementById("mutebtn"); volumeslider = document.getElementById("volumeslider"); fullscreenbtn = document.getElementById("fullscreenbtn"); // Add event listeners playbtn.addEventListener("click",playPause,false); seekslider.addEventListener("change",vidSeek,false); vid.addEventListener("timeupdate",seektimeupdate,false); mutebtn.addEventListener("click",vidmute,false); volumeslider.addEventListener("change",setvolume,false); fullscreenbtn.addEventListener("click",toggleFullScreen,false); } window.onload = intializePlayer; function playPause(){ if(vid.paused){ vid.play(); playbtn.style.background = "url(pause.png)"; vid.play(); } else { vid.pause(); playbtn.style.background = "url(play.png)"; vid.play(); aaac } } function vidSeek(){ var seekto = vid.duration * (seekslider.value / 100); vid.currentTime = seekto; } function seektimeupdate(){ var nt = vid.currentTime * (100 / vid.duration); seekslider.value = nt; var curmins = Math.floor(vid.currentTime / 60); var cursecs = Math.floor(vid.currentTime - curmins * 60); var durmins = Math.floor(vid.duration / 60); var dursecs = Math.floor(vid.duration - durmins * 60); if(cursecs < 10){ cursecs = "0"+cursecs; } if(dursecs < 10){ dursecs = "0"+dursecs; } if(curmins < 10){ curmins = "0"+curmins; } if(durmins < 10){ durmins = "0"+durmins; } curtimetext.innerHTML = curmins+":"+cursecs; durtimetext.innerHTML = durmins+":"+dursecs; } function vidmute(){ if(vid.muted){ vid.muted = false; mutebtn.innerHTML = "Mute"; } else { vid.muted = true; mutebtn.innerHTML = "Unmute"; } } function setvolume() { vid.volume = volumeslider.value / 100; } function toggleFullScreen(){ if(vid.requestFullScreen){ vid.requestFullScreen(); } else if(vid.webkitRequestFullScreen){ vid.webkitRequestFullScreen(); } else if(vid.mozRequestFullScreen){ vid.mozRequestFullScreen(); } } function show(id) { document.getElementById('video_controls_bar').style.visibility = "visible"; } function hide(id) { document.getElementById('video_controls_bar').style.visibility = "hidden"; } </script> </head> <body> <div id="video_player_box"> <video id="my_video" width="550" height="310" autoplay> <source src="wildlife.wmv"> </video> <div onMouseOver="show('video_controls_bar')" onMouseOut="hide(video_controls_bar)"> <div id="video_controls_bar" > <button id="playpausebtn"></button> <input id="seekslider" type="range" min="0" max="100" value="0" step="1"> <span id="curtimetext">00:00</span> / <span id="drtimetext">00:00</span> <button id="mutebtn">Mute</button> <input id="volumeslider" type="range" min="0" max="100" value="100" step="1"> <button id="fullscreenbtn">[ ]</button> </div> </div> </div> </body> </html> this sort of works. i want it to do the fullscreen controls only. when full screen is loaded i want the controls hidden as soon as full screen is toggled.
  11. i know im going to have to prevent default to get rid of the message you get when you go into full screen.
  12. <!DOCTYPE html> <html> <head> <style type="text/css"> div#video_player_box{ width:550px; background:#000; margin:0px auto; } div#video_controls_bar{ background: #333; padding:10px; color:#CCC; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; } button#playpausebtn{ background:url(pause.png); border:none; width:16px; height:18px; cursor:pointer; opacity:0.5; } button#playpausebtn:hover{ opacity:1; } input#seekslider{ width:180px; } input#volumeslider{ width: 80px; } input[type='range'] { -webkit-appearance: none !important; background: #000; border:#666 1px solid; height:4px; } input[type='range']::-webkit-slider-thumb { -webkit-appearance: none !important; background: #FFF; height:15px; width:15px; border-radius:100%; cursor:pointer; } </style> <script> var vid, playbtn, seekslider, curtimetext, durtimetext, mutebtn, volumeslider, fullscreenbtn; function intializePlayer(){ // Set object references vid = document.getElementById("my_video"); playbtn = document.getElementById("playpausebtn"); seekslider = document.getElementById("seekslider"); curtimetext = document.getElementById("curtimetext"); durtimetext = document.getElementById("durtimetext"); mutebtn = document.getElementById("mutebtn"); volumeslider = document.getElementById("volumeslider"); fullscreenbtn = document.getElementById("fullscreenbtn"); // Add event listeners playbtn.addEventListener("click",playPause,false); seekslider.addEventListener("change",vidSeek,false); vid.addEventListener("timeupdate",seektimeupdate,false); mutebtn.addEventListener("click",vidmute,false); volumeslider.addEventListener("change",setvolume,false); fullscreenbtn.addEventListener("click",toggleFullScreen,false); } window.onload = intializePlayer; function playPause(){ if(vid.paused){ vid.play(); playbtn.style.background = "url(pause.png)"; vid.play(); playbtn.innerHTML = "pause"; } else { vid.pause(); playbtn.style.background = "url(play.png)"; vid.play(); playbtn.innerHTML = "play"; } } function vidSeek(){ var seekto = vid.duration * (seekslider.value / 100); vid.currentTime = seekto; } function seektimeupdate(){ var nt = vid.currentTime * (100 / vid.duration); seekslider.value = nt; var curmins = Math.floor(vid.currentTime / 60); var cursecs = Math.floor(vid.currentTime - curmins * 60); var durmins = Math.floor(vid.duration / 60); var dursecs = Math.floor(vid.duration - durmins * 60); if(cursecs < 10){ cursecs = "0"+cursecs; } if(dursecs < 10){ dursecs = "0"+dursecs; } if(curmins < 10){ curmins = "0"+curmins; } if(durmins < 10){ durmins = "0"+durmins; } curtimetext.innerHTML = curmins+":"+cursecs; durtimetext.innerHTML = durmins+":"+dursecs; } function vidmute(){ if(vid.muted){ vid.muted = false; mutebtn.innerHTML = "Mute"; } else { vid.muted = true; mutebtn.innerHTML = "Unmute"; } } function setvolume() { vid.volume = volumeslider.value / 100; } function toggleFullScreen(){ if(vid.requestFullScreen){ vid.requestFullScreen(); } else if(vid.webkitRequestFullScreen){ vid.webkitRequestFullScreen(); } else if(vid.mozRequestFullScreen){ vid.mozRequestFullScreen(); } } function HideContent(e) { if(e.length > 1) { return; } document.getElementById(video_controls_bar).style.display = "none"; } function ShowContent(e) { if(e.length > 1) { return; } document.getElementById(video_controls_bar).style.display = "block"; } </script> </head> <body> <div id="video_player_box"> <video id="my_video" width="550" height="310" autoplay> <source src=""> </video> <div id="video_controls_bar" onHover="HideContent(); ShowContent();"> <button id="playpausebtn"></button> <input id="seekslider" type="range" min="0" max="100" value="0" step="1"> <span id="curtimetext">00:00</span> / <span id="drtimetext">00:00</span> <button id="mutebtn">Mute</button> <input id="volumeslider" type="range" min="0" max="100" value="100" step="1"> <button id="fullscreenbtn">[ ]</button> </div> </div> </body> </html>i this is my attempt to hide the videos control div on hover. well it failed. im trying to do this while in full screen. also how do i make the volume slider like youtubes?
  13. im also not sure how to the volume slider like youtube does. how is this achieved?
  14. <!DOCTYPE html> <html> <head> <style type="text/css"> div#video_player_box{ width:550px; background:#000; margin:0px auto;} div#video_controls_bar{ background: #333; padding:10px; color:#CCC; font-family:"Trebuchet MS", Arial, Helvetica, sans-serif; } button#playpausebtn{ background:url(pause.png); border:none; width:16px; height:18px; cursor:pointer; opacity:0.5; } button#playpausebtn:hover{ opacity:1; } input#seekslider{ width:180px; } input#volumeslider{ width: 80px;} input[type='range'] { -webkit-appearance: none !important; background: #000; border:#666 1px solid; height:4px; } input[type='range']::-webkit-slider-thumb { -webkit-appearance: none !important; background: #FFF; height:15px; width:15px; border-radius:100%; cursor:pointer; } </style> <script> var vid, playbtn, seekslider, curtimetext, durtimetext, mutebtn, volumeslider, fullscreenbtn; function intializePlayer(){ // Set object references vid = document.getElementById("my_video"); playbtn = document.getElementById("playpausebtn"); seekslider = document.getElementById("seekslider"); curtimetext = document.getElementById("curtimetext"); durtimetext = document.getElementById("durtimetext"); mutebtn = document.getElementById("mutebtn"); volumeslider = document.getElementById("volumeslider"); fullscreenbtn = document.getElementById("fullscreenbtn"); // Add event listeners playbtn.addEventListener("click",playPause,false); seekslider.addEventListener("change",vidSeek,false); vid.addEventListener("timeupdate",seektimeupdate,false); mutebtn.addEventListener("click",vidmute,false); volumeslider.addEventListener("change",setvolume,false); fullscreenbtn.addEventListener("click",toggleFullScreen,false); } window.onload = intializePlayer; function playPause(){ if(vid.paused){ vid.play(); playbtn.style.background = "url(pause.png)"; vid.play(); playbtn.innerHTML = "pause"; } else { vid.pause(); playbtn.style.background = "url(play.png)"; vid.play(); playbtn.innerHTML = "play"; } } function vidSeek(){ var seekto = vid.duration * (seekslider.value / 100); vid.currentTime = seekto; } function seektimeupdate(){ var nt = vid.currentTime * (100 / vid.duration); seekslider.value = nt; var curmins = Math.floor(vid.currentTime / 60); var cursecs = Math.floor(vid.currentTime - curmins * 60); var durmins = Math.floor(vid.duration / 60); var dursecs = Math.floor(vid.duration - durmins * 60); if(cursecs < 10){ cursecs = "0"+cursecs; } if(dursecs < 10){ dursecs = "0"+dursecs; } if(curmins < 10){ curmins = "0"+curmins; } if(durmins < 10){ durmins = "0"+durmins; } curtimetext.innerHTML = curmins+":"+cursecs; durtimetext.innerHTML = durmins+":"+dursecs; } function vidmute(){ if(vid.muted){ vid.muted = false; mutebtn.innerHTML = "Mute"; } else { vid.muted = true; mutebtn.innerHTML = "Unmute"; } } function setvolume() { vid.volume = volumeslider.value / 100; } function toggleFullScreen(){ if(vid.requestFullScreen){ vid.requestFullScreen(); } else if(vid.webkitRequestFullScreen){ vid.webkitRequestFullScreen(); } else if(vid.mozRequestFullScreen){ vid.mozRequestFullScreen(); } } </script> </head> <body> <div id="video_player_box"> <video id="my_video" width="550" height="310" autoplay> <source src="Tom_and_Jerry.mp4"> </video> <div id="video_controls_bar"> <button id="playpausebtn"></button> <input id="seekslider" type="range" min="0" max="100" value="0" step="1"> <span id="curtimetext">00:00</span> / <span id="drtimetext">00:00</span> <button id="mutebtn">Mute</button> <input id="volumeslider" type="range" min="0" max="100" value="100" step="1"> <button id="fullscreenbtn">[ ]</button> </div> </div> </body> </html> i cant seem to get the play/pause button to show when the play.png and pause.png buttons arent available. also do you know where i can get free icons of play and pause button ?
  15. <!doctype html> <html> <head> <meta charset="utf-8"> <title>Untitled Document</title> <script> var link = GetElementById("CmtBox"); link.onclick = function link() { document.getElementById("comment").style.display = "none"; document.getElementById("comment").style.display = ""; } </script> </head> <body> <form action="test.html " method="post" title="Post Comment" > <textarea cols="41" rows="5" wrap="hard" id="comment"></textarea> <a id="CmtBox" href="link" >Comment</a> </form> </body> </html> this is what i want to do but its not referencing the function. suggestions? i changed it because i didnt like the actual button. i would like to convert it so that it does exactly what the button did in the above example. this seems to be clearner.
  16. <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html" /> <meta name="author" content="" /> <script> ShowCommet{ document.getElementById("button").style.display = ""; } HideComment { document.getElementById("hidebutton").style.display = "none"; } </script> <title>Untitled 1</title> </head> <body> <div id="box1" style="background-color: silver" style="opacity: 50px";"> <button name="comment" id="button" onClick="ShowComment()"> <STRONG>Comment</STRONG> </button> <!--this adds the button--> <button name="hide" id="hidebutton" onClick="HideComment()" style="display:none"> <STRONG>Hide</STRONG> </button> </div> <br /> <textarea width="100" height="10" id="hidebox" onclick="HideComment()"></textarea> </body> </html> this text area wont hide. i dont know what i am doing wrong?
  17. im aware the javascript dont work. im not sure why it isnt working but ill figure that out.
  18. <!DOCTYPE HTML> <html> <head> <meta http-equiv="content-type" content="text/html" /> <meta name="author" content="" /> <script> ShowCommet{ document.getElementById("button").style.display = ""; } HideComment { document.getElementById("hidebutton").style.display = "none"; } </script> <title>Untitled 1</title> </head> <body> <div id="box1" style="background-color: silver" style="opacity: 50px";"> <button name="comment" id="button" onClick="ShowComment()"> <STRONG>Comment</STRONG> </button> <!--this adds the button--> <button name="hide" id="hidebutton" onClick="HideComment()" style="display:none"> <STRONG>Hide</STRONG> </button> </div> <br /> <textarea width="100" height="10" id="hidebox" onclick="HideComment()"></textarea> </body> </html> I cant seem to add height width, or opacity of the background to this div. what am i doing wrong?
  19. that only makes the entire box hidden when you click it.
  20. <head> <script> function HideComment() { document.getElementsByTagName("textarea")[0].style.display = "none"; } </script> </head> <body> <textarea name="" cols="" rows="" id="comments">leave comment</textarea> <button name="hide" onClick="HideComment()"> </button> </body> </html> like this?
  21. it hides it when i click the corner i think a button would be better but im not sure on how to go about doing that.
  22. <!DOCTYPE html> <html> <head> <script> function HideComment() { document.getElementsByTagName("textarea")[0].style.display = "none"; } </script> </head> <body> <textarea name="" cols="" rows="" id="comments" onClick="HideComment()">leave comment</textarea> </body> </html> so this should hide it when its clicked? how would i make a button hide it instead?
  23. <!DOCTYPE html> <html> <head> <script> function HideComment() { document.GetElementById("comments").hide("textarea") } </script> </head> <body> <textarea name="" cols="" rows="" id="comments" onClick="">leave comment</textarea> </body> </html> i am trying to get the text area to hide when i click a button. this is what i have but doesnt seem to work. can someone help me?
  24. oops sorry <?php // Make a MySQL Connection mysql_connect("127.0.0.1", "root", "") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $result = mysql_query("SELECT comments FROM users") or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ if(!isset($dataString)){ $dataString = $row['comments']; } else{ $dataString .= "<br><br>{$row['commens']}"; } } // http://forums.phpfreaks.com/topic/282059-comment-system/ $page = <<<PAGE <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <form name="input" action="" method="get"> <div id="commentsr"> $dataString </div> <textarea id="myMessage" name="comments" cols="30" rows="10" style="width: 400px; height: 83px;"></textarea> <input type="submit" value="Submit"> </form> </body> </html> PAGE; echo $page; ?>
  25. Notice: Undefined variable: dataString in C:\wamp\www\comments.php on line 31 <?php // Make a MySQL Connection mysql_connect("127.0.0.1", "root", "") or die(mysql_error()); mysql_select_db("test") or die(mysql_error()); $result = mysql_query("SELECT comments FROM users") or die(mysql_error()); while($row = mysql_fetch_assoc($result)){ if(!isset($dataString)){ $dataString = $row['comments']; } else{ $dataString .= "<br><br>{$row['commens']}"; } } $page = <<<PAGE <!DOCTYPE html> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <form name="input" action="" method="get"> <div id="commentsr"> $dataString </div> <textarea id="myMessage" name="comments" cols="30" rows="10" style="width: 400px; height: 83px;"></textarea> <input type="submit" value="Submit"> </form> </body> </html> PAGE; echo $page; ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.