Jump to content

JJJorgensen

Members
  • Content count

    10
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JJJorgensen

  • Rank
    Newbie
  1. JJJorgensen

    Modal with dynamic URL

    This is just a question but if you want code, let me know. Is there some restriction on URL's in modals? This could be my hosting service restricting it. They do the strangest things. When I create the page in my editor it works but when I publish it it doesn't work.
  2. JJJorgensen

    Option value versus index

    Well the value works in getting the script to run but when I try to populate my URL it's still picking up the text. ??? if (Typesel.options[Typesel.value] = "Article") { document.getElementById("myLink").href = "http://www.myOrg.org/Star/" + Mnthsel.options[Mnthsel.selectedIndex].text + " " + Yrsel.options[Yrsel.selectedIndex].text + " Article " + Typesel.options[Typesel.selectedIndex].text + "." + Formatsel.value; }
  3. JJJorgensen

    Option value versus index

    Ok, I've been having a hard time with this thing. It seems like it should be simple but I keep running into obstacles that I just can't seem to fix. I've got a bunch of files that I want my users to be able to access. There's 2 types (articles, calendars) and each needs to be viewed in 1 of 3 formats (pdf, word, webpage). these files are monthly. So I have the following option boxes - Year, Month, Type, format. User selects and then clicks a button to get the URL link. 2 problems - 1) the extensions of the calendars are .pdf, .docx and .html whereas the article extensions are .pdf, .doc and .htm; 2) the file name format is different - calendar name format is Year Month Calendar.extension - article name is Month Article Year.extension. This is where I'm at codewise so far. <form> Select the year: <select id="myYear"> <option>2018</option> <option>2017</option> <option>2016</option> <option>2015</option> </select> <br><br> Select the month: <select id="myMonth"> <option>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> <br><br> Select Calendar or Article: <select id="myType"> <option>Article</option> <option>Calendar</option> </select> <br><br> Select PDF, Word or Webpage: <select id="myFormat"> <option>PDF</option> <option>doc</option> <option>htm</option> </select> <br><br> <input type="button" onclick="myFunction()" value="Click Me!"> <br><br> </form> <a id="myLink" href="http://www.myOrg.org/Article/HomePage.htm" target="_blank">Star Homepage and Submission</a> <script> function myFunction() { var Yrsel = document.getElementById("myYear"); var Mnthsel = document.getElementById("myMonth"); var Typesel = document.getElementById("myType"); var Formatsel = document.getElementById("myFormat"); document.getElementById("myLink").innerHTML = "Get Star"; if (Typesel.options[Typesel.value] = "Article") { document.getElementById("myLink").href = "http://www.myOrg.org/Article/" + Mnthsel.options[Mnthsel.selectedIndex].text + " " + Yrsel.options[Yrsel.selectedIndex].text + " Article " + Typesel.options[Typesel.selectedIndex].text + "." + Formatsel.options[Formatsel.selectedIndex].text; } if (Typesel.options[Typesel.value] = "Calendar") { document.getElementById("myLink").href = "http://www.myOrg.org/Article/" + Mnthsel.options[Mnthsel.selectedIndex].text + " Calendar " + Yrsel.options[Yrsel.selectedIndex].text + " " + Typesel.options[Typesel.selectedIndex].text + "." + Formatsel.options[Formatsel.selectedIndex].text; } } </script> </div> </div> It works but I would like to use value instead of Index for the extension (format) options. So I can put something like <option value="htm">Webpage - viewable in browser, not formatted for printing</option>. Of course I would use an if statement to take care of the extra letters in the extensions. However, when I try using the value in the code it doesn't work. Formatsel.options[Formatsel.value].text HELP!!! Why won't the value work? I get a URL of XXXX.undefined
  4. JJJorgensen

    Modals with combo boxes

    Ok I have 2 types of files I want people to be able to get. Article and Calendar. The differences are 1) the file names are a bit different - Year month Article.ext and Calendar month year.ext and 2) the extensions are different - doc for articles, docx for calendar, htm for article, html for calendar. There's a bunch of files so I'd really not have to go changing the file names. Here's the code I have so far. <style> body {font-family: Arial, Helvetica, sans-serif;} /* The Modal (background) */ .modal { display: none; /* Hidden by default */ position: fixed; /* Stay in place */ z-index: 1; /* Sit on top */ padding-top: 100px; /* Location of the box */ left: 0; top: 0; width: 100%; /* Full width */ height: 100%; /* Full height */ overflow: auto; /* Enable scroll if needed */ background-color: rgb(0,0,0); /* Fallback color */ background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ } /* Modal Content */ .modal-content { background-color: #fefefe; margin: auto; padding: 20px; border: 1px solid #888; width: 80%; } /* The Close Button */ .close { color: #aaaaaa; float: right; font-size: 28px; font-weight: bold; } .close:hover, .close:focus { color: #000; text-decoration: none; cursor: pointer; } </style> </head> <body> <h2>Please Select Star or Calendar.</h2> <!-- Trigger/Open The Modal --> <button id="myBtn">Monthly Star</button> <!-- The Modal --> <div id="myModal" class="modal"> <!-- Modal content --> <div class="modal-content"> <span class="close">&times;</span> <form> Select the year: <select id="mySelect"> <option>2018</option> <option>2017</option> <option>2016</option> <option>2015</option> </select> <br /> Select the month: <select id="mySelect1"> <option>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> <br /> Select PDF, Word or Webpage: <select id="mySelect3"> <option>pdf</option> <option>doc</option> <option>htm</option> </select> <br><br> <input type="button" onclick="myFunction()" value="Click Me!"> <br /> </form> <a id="myLink" href="http://www.bethlehemvinton.org/Star/April 2017 Bethlehem Star.pdf">Microsoft</a> <script> function myFunction() { var obj = document.getElementById("mySelect"); var obj1 = document.getElementById("mySelect1"); var obj3 = document.getElementById("mySelect3"); document.getElementById("myLink").innerHTML = "New Link"; document.getElementById("myLink").href = "http://www.bethlehemvinton.org/Star/" + obj1.options[obj1.selectedIndex].text + " " + obj.options[obj.selectedIndex].text + " Bethlehem Star." + obj3.options[obj3.selectedIndex].text; document.getElementById("myLink").target = "_blank"; } </script> </div> </div> <!-- Trigger/Open The Modal --> <button id="myBtn1">Monthly Calendar</button> <!-- The Modal --> <div id="myModal1" class="modal"> <!-- Modal content --> <div class="modal-content"> <span class="close">&times;</span> <form> Select the year: <select id="mySelectC"> <option>2018</option> <option>2017</option> <option>2016</option> <option>2015</option> </select> <br /> Select the month: <select id="mySelectC1"> <option>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> <br /> Select PDF, Word or Webpage: <select id="mySelectC3"> <option>pdf</option> <option>docx</option> <option>htm</option> </select> <br><br> <input type="button" onclick="myFunctionC()" value="Click Me!"> <br /> </form> <a id="myLinkC" href="http://www.bethlehemvinton.org/Star/April 2017 Bethlehem Star.pdf">Microsoft</a> <script> function myFunctionC() { var objC = document.getElementById("mySelectC"); var objC1 = document.getElementById("mySelectC1"); var objC3 = document.getElementById("mySelectC3"); document.getElementById("myLinkC").innerHTML = "New Link"; document.getElementById("myLinkC").href = "http://www.bethlehemvinton.org/Star/Calendar for " + objC1.options[obj1.selectedIndex].text + " " + objC3.options[obj3.selectedIndex].text; document.getElementById("myLinkC").target = "_blank"; } // Get the modal var modal = document.getElementById('myModal'); // Get the button that opens the modal var btn = document.getElementById("myBtn"); // Get the <span> element that closes the modal var span = document.getElementsByClassName("close")[0]; // When the user clicks the button, open the modal btn.onclick = function() { modal.style.display = "block"; } // When the user clicks on <span> (x), close the modal span.onclick = function() { modal.style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal) { modal.style.display = "none"; } } // Get the modal var modal1 = document.getElementById('myModal1'); // Get the button that opens the modal var btn1 = document.getElementById("myBtn1"); // Get the <span> element that closes the modal var span1 = document.getElementsByClassName("close")[0]; // When the user clicks the button, open the modal btn.onclick = function() { modal1.style.display = "block"; } // When the user clicks on <span> (x), close the modal span1.onclick = function() { modal1.style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal1) { modal1.style.display = "none"; } } </script> </body> If I do just 1 modal (the first one) it works fine. But when I add the 2nd it breaks so I'm assuming I've got 2 variables somewhere with the same name. 1) is this the easiest way to handle this? 2) I'd rather not have the link "Current..." showing but if I delete it then I can't make it work. I know I could probably do some scripting to create it on button click but ... well, sad to say I'm running out of time to get this done. Any help would be appreciated.
  5. JJJorgensen

    Populating link with combo box values

    Thanks. It doesn't matter when it changes as long it's before populating the link. I've decided to try a different approach as the file names are different for Calendar and Article beyond the extension. So I was thinking that I could do 2 modals. 1 for article and 1 for calendar. but they're not working. I'm starting a different topic for that.
  6. JJJorgensen

    Populating link with combo box values

    Ok, so I have 4 combo boxes with $Year, $Month, $Type, $extension to create file name of URL. http://www.myOrg.Org/Articles/$Month + $Year + MyOrg + $Type . $extension This is what I have (doing only 1 variable - Year). <form> Select the year: <select id="mySelect"> <option>2018</option> <option>2017</option> <option>2016</option> <option>2015</option> </select> Select the month: <select id="mySelect1"> <option>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> Select Article or Calendar: <select id="mySelect2"> <option>Article</option> <option>Calendar</option> </select> Select PDF, Word or Webpage: <select id="mySelect3"> <option>pdf</option> <option>doc</option> <option>htm</option> </select> <br><br> <input type="button" onclick="myFunction()" value="Click Me!"> </form> <a id="myLink" href="http://www.myOrg.org/Article/April 2018 myOrg.pdf">Current Article</a> <script> function myFunction() { var obj = document.getElementById("mySelect"); var obj1 = document.getElementById("mySelect1"); var obj2 = document.getElementById("mySelect2"); var obj3 = document.getElementById("mySelect3"); document.getElementById("myLink").innerHTML = "New Link"; document.getElementById("myLink").href = "http://www.myOrg.org/Article/" + obj1.options[obj1.selectedIndex].text + " " + obj.options[obj.selectedIndex].text + " " + obj2.options[obj2.selectedIndex].text + "." + obj3.options[obj3.selectedIndex].text; document.getElementById("myLink").target = "_blank"; } </script> Works but now I want to have some if then statements. Instead of pdf, doc and htm I want to show PDF File, Word Document and Webpage but when it inserts it into the address is needs to be pdf, doc and htm. But if Calendar is selected it needs to be docx not doc. So....kinda stuck at this point.
  7. JJJorgensen

    Email response determined by DB validation

    Automating it. I know how to send an automated email to me as admin but sending it back out pre-formatted is a grey area. I've been doing research on it and it looks like I just need to work on the code. Thanks
  8. Ok, not sure if this is the right forum or not so please point me in the right direction if it's not. Before I dig into the how, I want to know if it's possible to have users request a link through an email link and .. 1) if their email is an approved users they get an email with the link 2) if their email is NOT approved they get a "sorry, you need to be authenticated" message I have a DB of approved emails already on the server. Would it be easier to have the sorry message be an email or can I create a modal that pops up? Also, if they get the sorry message, pretty sure it's possible to send an email back to me indicating an unauthorized request was made, right?
  9. I want to have any text that is bold, italic etc. to be a specific color. And yes, this if for ALL of my website. I've been using p.italic, p.bold etc. Is there a shortcut to do everything but normal text?
  10. JJJorgensen

    Listbox ... java...Help?

    Ok, I might be in the wrong place, pardon if I am. It's been awhile since I coded anything let alone Java and I need a real quick refresher. Quick outline: Online Monthly newsletter. I want user to select Year and month, and display type then hit submit button which will then open a new window with the corresponding Newsletter in the corresponding format. These are all 1 page html documents. Listbox1 has the months, listbox2 has the years. Button1, Button2, Button3 are Show as PDF, Show as Word, Show in Browser respectively. Filenames are Month Year Newsletter.EXTension So it should be something like: <script> function myFunction() { var x = document.getElementById("frm1"); var text = ""; var i; for (i = 0; i < x.length ;i++) { text += x.elements[i].value + "<br>"; } document.getElementById("demo").innerHTML = text; } </script> but this is not on a form, would it be easier to create a form? I just have them as listboxes on a page. Like I said, I can do it, just rusty.
×