Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Today
  3. Hi. I just got home and thanks for the quick reply - i think i will have some considering to do but otherwise both options looks pretty good to me. Thanks for the support! For now i will do your first option but i will still consider your second optional code for future ^^ Many thanks ^^
  4. Also, don't worry about a closing img tag. It's not needed.
  5. Have you declared the upDate() function yet? In your onmouseout attribute, the unDo function needs parentheses () to run correctly. For now, add a <script> tag in your HTML document and try to declare those functions. Once you have written some code I can help correct any mistakes.
  6. The names of the weekdays each need to be added manually unless you can pull them from a database. Using a loop here would just make the code longer and less organized. If you really want to add another loop, you can create an array of weekday names and construct the HTML for a table row by looping through them. // Add weekdays header $weekday_names = ['Man','Tir','Ons','Tor','Fre','Lør','Søn']; $header = '<tr>'; foreach($weekday_names as $name) { $header .= "<td>$name</td>"; } $header .= '</tr>'; $HTMLOUT_weeks[] = $header;
  7. I'm still studying JavaScript and what I'd like to know how to code this If I have: <div id="image"> hover over an image below to display here </div> <img class="home" src="Dr.jpg" onmouseover="upDate (this)" onmouseout= "unDo" Alt="my school photo" > </img> If I hover on the image the text in the div changes together with the background-color Thanks
  8. I'm still studying this and what I'd like to know is this If I have <div id="image"> hover over an image below to display here </div> <img class="home" src="Dr.jpg" onmouseover="upDate (this)" onmouseout= "unDo" Alt="my school photo" > </img> If I hover on the image the text in the div changes together with the background-color Thanks
  9. Thanks alot! However, is it not possible to do this dynamicly? Would i be able to create another loop maybe (instead of a static array you do here, just replacing this with a loop? - and should it be a for loop like the one under?) - will take a look at it either way when home - on the phone right now. Thanks for the answer so far tho!
  10. Let's set a few things up first. Firstly, in HTML create the image tag with an id and some alt text: <img id="image" src="image.png" alt="image-text"> Next, in JavaScript let's assign the image tag to a variable. Doing so will make it's alt property accessible for later use in the div tag: // assign the img tag by id to the "img" variable let img = document.getElementById("image"); Now let's create an empty div in HTML, with an id of "alt-text". You can do this entirely in JS, but let's use HTML for this example. Add it just below your img tag from the first step: <div id="alt-text"></div> Next, in JavaScript let's create a variable to reference the empty div and a function to set the text and background colour of the div: imgFunc = () => { // assign the empty div to a variable let altDiv = document.getElemenetById("alt-text"); // set the text of the div to the alt property from the img variable created earlier altDiv.innerHtml = img.alt; // set the background colour of the div altDiv.style.backgroundColor = "blue"; } Now, there are better ways to set the text, but innerHtml is a quick way to demonstrate. Explore the options available to you on the W3Schools website. I've gone with blue here as the background colour, but you can choose whatever colour you want. Finally, let's add a mouseover event to the img tag from the first step, and use it to call our function: <img id="image" src="image.png" alt="image-text" onmouseover="imgFunc()"> And that's it.
  11. How to code this in JavaScript. When onmouse hover on an img the Alt text appears in a div, and the div background changes too. Thanks in advance
  12. I have a very simple dropdown box for two language selection (EN/FR) which I got from W3Schools. It works fine but what I want is that when the language is selected it becomes the default choice for visitors unless they choose otherwise. I assume this must involve a cookie but how do I code for this? I am using straight html, no CMS. Is it possible? Thanks for any help <div class="dropdown"> <button class="dropbtn">EN</button> <div class="dropdown-content"> <a href="https://websitename/fr/page.html">Français</a> </div></div>
  13. Can you offer more specifics on what you're hoping to achieve? There's far too many ways to create buttons outside of simply using a button tag in a form. For example, CSS-based, image-based, entirely JavaScript-based through DOM manipulation. You could get unnecessarily creative and launch multiple server instances like Rust/Rocket, Python, Node, etc, with each generating separate buttons of their own and pipe them all through an Apache ProxyPass if you really wanted. Excessive, but creative nonetheless.
  14. _brym


    Who's your provider? If it's a shared hosting provider like Hostgator or the like, chances are it's running Apache/cPanel. In which case, they won't let you. If you want to use a service provider and not your own computer, you'll need a provider like Google Cloud, Amazon AWS, Linode, Digital Ocean, etc. Somebody who will let you run Virtual Machines or instances of operating systems where you would then remote in or use their web interface to install node and any dependencies. The alternative is to self-host. That's easy to do if you can afford to leave a computer running (for production/live websites). To get around the lack of static IP addresses, use a 3rd party service like NoIP.
  15. But you're then technically manipulating their browsing history. Privacy laws in some countries might not permit that.
  16. Could you give a bit more context? Are you having problems with code you've written for a website you uploaded to your hosting provider? If so, can you share the code here for us to look over and possibly help you fix?
  17. The news.js file you pointed to wouldn't be of any use to you anyway. That file is what Sony use to load additional scripts conditionally. A quick look at their sitemap gave me a link to their RSS feed. So I'd recommend you follow RSS tutorials here if you want to echo Sony's news feed. The RSS link is this: https://www.sony.com/en/SonyInfo/News/Press/data/pressrelease_for_top.xml
  18. From within pages under the same domain name, yes, do what Ingolme said. If you're hosting multiple names (virtual hosts approach), use the FQDN or fully qualified domain name (i.e. the whole thing: http(s)://www.somesite.com/things)
  19. They will all essentially offer you a glorified text editor. Because that's all you need. If you were self-hosting, you would use notepad, notepad++, gedit, or command line / terminal variants like vim and nano.
  20. Or you could go with a dynamic dns-style service like noip.com
  21. Yesterday
  22. The way to solve it is to set the table headers outside of the loop, before the loop begins. In the case of your code it can be done near the line where $HTMLOUT_weeks is first initialized. # Array For Calendar // $weeks = []; // $week = ''; $HTMLOUT_weeks = []; // Creating an array. $HTMLOUT_week = ''; // Add weekdays header $HTMLOUT_weeks[] = '<tr><th>Man</th><th>Tir</th><th>Ons</th><th>Tor</th><th>Fre</th><th>Lør</th><th>Søn</th></tr>';
  23. Hello W3S! Been a while as always. So my new project is a calendar. I got it working. I found some basic code online HOWEVER! I have a simple HTML-Table that generates the calendar dates (thats perfect), but the thing is, at the very TOP of that table, i wish to show the week-days for a single week (mon, tue, wed...) but only once and dynamicly if possible - just not sure on how to achieve this! Any ideas would be lovely! - PS: Sorry for my code... have not ordered anything just yet, trying to re-do a lot of code and re-write it so that i can understand it just a little better myself since its been a while ^^ Here is my current code - thanks n advance! :) <?php require_once("calendar_1-config.php"); require_once("calendar_1-functions.php"); ?> <!DOCTYPE html> <?= $CONFIG___html_lang; ?> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>NORMAL KALENDER (+ EVENTS)</title> <!-- Favicons --> <link href="assets/img/favicon.png" rel="icon"> <link href="assets/img/apple-touch-icon.png" rel="apple-touch-icon"> <!-- Vendor CSS --> <link href="assets/vendor/aos/aos.css" rel="stylesheet"> <link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"> <link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet"> <link href="assets/vendor/boxicons/css/boxicons.min.css" rel="stylesheet"> <link href="assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet"> <link href="assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet"> <!-- Main CSS --> <link rel="stylesheet" href="assets/css/calendar_1-style.css"> </head> <body> <?php # LINE-BREAKS AND A LINE -> just info for each variable and what they show! echo '<br />'; echo '<hr />'; echo '...(1) - NEXT PART...'; echo '<br />'; echo '...VARIABLES AND WHAT THEY SHOW EACH...'; echo '<hr />'; echo '<br />'; # GET -> Year & Month if( isset($_GET['GET___year_AND_month']) ) { $GET___year_AND_month = $_GET['GET___year_AND_month']; // Format: 1992-11 # Year, Month } else { $GET___year_AND_month = date('Y-m'); // Format: 1992-11 # Year, Month } echo '<p>"$GET___year_AND_month" -> <b>'.$GET___year_AND_month.'</b></p>'; # Checking The Format $TIMESTAMP_UNIX___FROM___GET___year_AND_month = strtotime($GET___year_AND_month . '-01'); if( $TIMESTAMP_UNIX___FROM___GET___year_AND_month === false ) { $GET___year_AND_month = date('Y-m'); // Format: 1992-11 # Year, Month $TIMESTAMP_UNIX___FROM___GET___year_AND_month = strtotime($GET___year_AND_month . '-01'); } echo '<p>"$GET___year_AND_month" -> <b>'.$GET___year_AND_month.'</b></p>'; echo '<p>"$TIMESTAMP_UNIX___FROM___GET___year_AND_month" from "$GET___year_AND_month" -> <b>'.$TIMESTAMP_UNIX___FROM___GET___year_AND_month.'</b></p>'; # Today (Format: yyyy-mm-dd) $today = date('Y-m-j'); // Format: 1992-11-08 # Year, Month, Day echo '<p>"$today" -> <b>'.$today.'</b></p>'; # Title_1 (Format: MONTH_NAME, yyyy) -> (Example Format: November, 1992) $TITLE_1___CURRENT_month_AND_year = date('F, Y', $TIMESTAMP_UNIX___FROM___GET___year_AND_month); echo '<p>"$TITLE_1___CURRENT_month_AND_year" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>'.$TITLE_1___CURRENT_month_AND_year.'</b></p>'; # Title_2 (Format: yyyy, MONTH_NAME, DATE (...1'st...)) -> (Example Format: 1992, November, 8'th) $TITLE_2 = date('Y, F, d\'S', $TIMESTAMP_UNIX___FROM___GET___year_AND_month); echo '<p>"$TITLE_2" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>'.$TITLE_2.'</b></p>'; # CREATE LINKS FOR - Previous & Next - Month's $prev = date('Y-m', strtotime('-1 month', $TIMESTAMP_UNIX___FROM___GET___year_AND_month)); // Previous Month $next = date('Y-m', strtotime('+1 month', $TIMESTAMP_UNIX___FROM___GET___year_AND_month)); // Next Month echo '<p>"$prev" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>'.$prev.'</b></p>'; echo '<p>"$next" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>'.$next.'</b></p>'; # Total Numbers Of Days In The Month $month_days_count = date('t', $TIMESTAMP_UNIX___FROM___GET___year_AND_month); echo '<p>"$month_days_count" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>'.$month_days_count.'</b></p>'; # 1:Monday, # 2:Tuesday, # 3:Wednesday, # 4:Thursday, # 5:Friday, # 6:Saturday, # 7 "0?":Sonday, # ...Day of the week... $STR___integer_string___of_the_day_of_the_week_we_are_in = date('N', $TIMESTAMP_UNIX___FROM___GET___year_AND_month); // ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0) $STRING_1 = $STR___integer_string___of_the_day_of_the_week_we_are_in; echo '<p>"$STR___integer_string___of_the_day_of_the_week_we_are_in" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>We\'re currently in day nr.<u>'.$STR___integer_string___of_the_day_of_the_week_we_are_in.'</u> of the week!</b></p>'; # ...Day of the year... $STR___integer_string___day_of_the_year = date('z', $TIMESTAMP_UNIX___FROM___GET___year_AND_month); // $STRING_2 = $STR___integer_string___day_of_the_year; echo '<p>"$STR___integer_string___day_of_the_year" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>We\'re currently in day nr.<u>'.$STR___integer_string___day_of_the_year.'</u> of the year!</b></p>'; # ...Week number of the year... $STR___integer_string___week_of_the_year = date('W', $TIMESTAMP_UNIX___FROM___GET___year_AND_month); // $STRING_3 = $STR___integer_string___week_of_the_year; echo '<p>"$STR___integer_string___week_of_the_year" from "$TIMESTAMP_UNIX___FROM___GET___year_AND_month" -> <b>We\'re currently in week nr.<u>'.$STR___integer_string___week_of_the_year.'</u> of the year!</b></p>'; # LINE-BREAKS AND A LINE echo '<br />'; echo '<hr />'; echo '...(2) - NEXT PART...'; echo '<hr />'; echo '<br />'; # Array For Calendar // $weeks = []; // $week = ''; $HTMLOUT_weeks = []; // Creating an array. $HTMLOUT_week = ''; # Adding Empty Cell's $HTMLOUT_week .= str_repeat('<td></td>', $STRING_1 - 1); // str_repeat == "Repeat a string" # LINE-BREAKS AND A LINE echo '<br />'; echo '<hr />'; echo '...(3) - NEXT PART...'; echo '<hr />'; echo '<br />'; # Programming The Calendar Output $TIMESTAMP_UNIX = $TIMESTAMP_UNIX___FROM___GET___year_AND_month; for( $day = 1; $day <= $month_days_count; $day++, $STRING_1++ ) { $CALCULATE_dates = date('Y-m-'.$day, $TIMESTAMP_UNIX); $FIND_dates_names_FULL_DETAILS = date("D M j G:i:s T Y", strtotime($CALCULATE_dates)); // echo $FIND_dates_names_FULL_DETAILS . '<br />'; if( $today == $CALCULATE_dates ) { // $HTMLOUT_week .= '<td class="today" title="(FIND_CURRENT_dates_names_FULL_DETAILS) - mangler at lave følgende!">'; $HTMLOUT_week .= '<td style="background-color: rgba( 0, 0, 0, 0.5 );">'; } else { // $HTMLOUT_week .= '<td title="(FIND_CURRENT_dates_names_FULL_DETAILS) - mangler at lave følgende!">'; $HTMLOUT_week .= '<td>'; } $HTMLOUT_week .= $day . '</td>'; # Sunday OR Last Day Of The Month if( $STRING_1 % 7 == 0 || $day == $month_days_count ) { # Last Day(s) Of The Month if( $day == $month_days_count && $STRING_1 % 7 != 0 ) { # Add Empty Cell's $HTMLOUT_week .= str_repeat('<td></td>', 7 - $STRING_1 % 7); } // $HTMLOUT_weeks[] = '<tr>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>MAN</b>'; // $HTMLOUT_weeks[] = '<b>Man</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>TIR</b>'; // $HTMLOUT_weeks[] = '<b>Tir</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>ONS</b>'; // $HTMLOUT_weeks[] = '<b>Ons</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>TOR</b>'; // $HTMLOUT_weeks[] = '<b>Tor</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>FRE</b>'; // $HTMLOUT_weeks[] = '<b>Fre</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>LØR</b>'; // $HTMLOUT_weeks[] = '<b>Lør</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '<td align="middle">'; // // $HTMLOUT_weeks[] = '<b>SØN</b>'; // $HTMLOUT_weeks[] = '<b>Søn</b>'; // $HTMLOUT_weeks[] = '</td>'; // $HTMLOUT_weeks[] = '</tr>'; $HTMLOUT_weeks[] = '<tr>' . $HTMLOUT_week . '</tr>'; $HTMLOUT_week = ''; } } echo '<div class="container-fluid">'; echo '<div class="row">'; echo '<div class="col-lg-12">'; echo '<div class="table-responsive">'; echo '<table class="table table-bordered">'; echo '<tr>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '<td align="right">'; echo '<a href="#">'; echo '&lt; PREV'; echo '</a>'; echo '</td>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '<td align="middle">'; echo '<a href="#">'; echo 'PRESENT'; echo '</a>'; echo '</td>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '<td align="left">'; echo '<a href="#">'; echo 'NEXT &gt;'; echo '</a>'; echo '</td>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '</tr>'; foreach( $HTMLOUT_weeks as $week ) { echo $week; } echo '</table>'; echo '</div>'; echo '</div>'; echo '</div>'; echo '</div>'; /* // echo '<table border="1" cellpadding="0" cellspacing="0">'; echo '<table class="table table-bordered">'; echo '<tr>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '<td align="right">'; echo '<a href="#">'; echo '&lt; PREV'; echo '</a>'; echo '</td>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '<td align="middle">'; echo '<a href="#">'; echo 'PRESENT'; echo '</a>'; echo '</td>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '<td align="left">'; echo '<a href="#">'; echo 'NEXT &gt;'; echo '</a>'; echo '</td>'; echo '<td colspan="0">'; echo '&nbsp;'; echo '</td>'; echo '</tr>'; echo '</table>'; */ ?> <!-- Vendor JS --> <script src="assets/vendor/aos/aos.js"></script> <script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="assets/vendor/glightbox/js/glightbox.min.js"></script> <script src="assets/vendor/isotope-layout/isotope.pkgd.min.js"></script> <script src="assets/vendor/purecounter/purecounter.js"></script> <script src="assets/vendor/swiper/swiper-bundle.min.js"></script> <script src="assets/vendor/typed.js/typed.min.js"></script> <script src="assets/vendor/waypoints/noframework.waypoints.js"></script> <!-- Main JS --> <script src="assets/js/main.js"></script> </body> </html>
  24. Last week
  25. Is this what you're talking about? https://stackoverflow.com/questions/45591769/the-correct-way-to-wrap-a-button-with-a-link
  26. Hey guys, Are you aware of the button wrap technique with a href? It’s not working for me. I thought it’s an internal error with HTML5. Let’s get together on this and see what’s wrong. Hope to hear from you soon!
  27. Hello, thank you for your help.🙂 Unfortunately i couldn't make it work either.
  28. You cannot return the data, you have to do something with it. Print it, manipulate it, store it into a variable or something else. In my previous example, I used console.log() to write the data to the Javascript console. Javascript is not allowed to write to files, neither on the server nor on the user's computer, but you can prompt the user to download a generated text file like this: <script> function file_get_contents(filename, callback) { fetch(filename).then((resp) => resp.text()).then(callback); } function handleResponse(data) { // This code generates a text file with the data and asks the user to download it var blob = new Blob([data], { type: "text/plain;charset=utf-8" }); var a = document.createElement("a"); a.href = URL.createObjectURL(blob); a.download = "file.txt"; document.body.appendChild(a); a.click(); setTimeout(function() { document.body.removeChild(a); window.URL.revokeObjectURL(url); }, 0); } file_get_contents('https://mediainfo.tf1.fr/mediainfocombo/L_LCI?context=MYTF1&pver=4014002', handleResponse); </script>
  1. Load more activity
  • Create New...