Click here to Skip to main content
14,736,362 members
Home » Discussions » JavaScript
   

JavaScript

 
QuestionSearch Engine without DB using JS Pin
javadev20904-Oct-19 10:06
Memberjavadev20904-Oct-19 10:06 
AnswerRe: Search Engine without DB using JS Pin
jkirkerx8-Oct-19 14:45
professionaljkirkerx8-Oct-19 14:45 
GeneralRe: Search Engine without DB using JS Pin
javadev20908-Oct-19 20:44
Memberjavadev20908-Oct-19 20:44 
GeneralRe: Search Engine without DB using JS Pin
jkirkerx9-Oct-19 8:35
professionaljkirkerx9-Oct-19 8:35 
Questionjquery validation in drop down Pin
Shraddha_Patel3-Oct-19 19:50
MemberShraddha_Patel3-Oct-19 19:50 
AnswerRe: jquery validation in drop down Pin
ZurdoDev4-Oct-19 2:04
professionalZurdoDev4-Oct-19 2:04 
AnswerRe: jquery validation in drop down Pin
jkirkerx8-Oct-19 14:47
professionaljkirkerx8-Oct-19 14:47 
QuestionHow to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
codeguy13-Oct-19 20:14
Membercodeguy13-Oct-19 20:14 
I have created a dynamic drop-down list using JavaScript and I want the alert that is triggered on the screen after making the selections to say the wrestling level picked the wrestler name picked and the year in the alert and after that I want the JavaScript code to display an I-frame that contains a table of that wrestler's videos for that year. I somewhat understand the logic of the drop-down list but I don't know how to put the selections that I make on the list display in the alert such as the wrestling level picked the wrestler name picked and the year. Right now all the alert does is displays the final selection which is the year but I want all the selection information to be put into the alert. Secondly after this alert displays I want the JavaScript code to trigger the creation of an I-frame that displays a table with all the wrestler's videos for that year. I know how to create the table and information related with that but I can't seem to figure out the code to create an I-frame. As far as JavaScript goes I'm not very experienced and would be considered a beginner any help would be appreciated. The code I have is below.

<!DOCTYPE html>
<html lang="en-us">
<head>
<title>Test</title>
<script type="text/javascript">
function urlRedirectTo(obj)
			{
				alert('Here are all the wrestling videos for '+obj);
				if('2013-2014' == obj)
				var iframe = document.createElement('iframe');
				var html = '<body>Foo</body>';
				document.body.appendChild(iframe);
				iframe.contentWindow.document.open();
				iframe.contentWindow.document.write(html);
				iframe.contentWindow.document.close();
				//if('wordpress_version2' == obj)
					//window.location = 'https://wordpress.org/download/';
			}
			function dynamicdropdown(listindex)
            {
                document.getElementById("sub_subcategory").length = 0;
                document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                document.getElementById("subcategory").length = 0;
                switch (listindex)
                {
                    case "Elementary" :
                        document.getElementById("subcategory").options[0]=new Option("Please select Wrestler","");
                        document.getElementById("subcategory").options[1]=new Option("Wordpress","Wordpress");
                        document.getElementById("subcategory").options[2]=new Option("Magento","Magento");
                        break;
                    
                    case "Junior High" :
                        document.getElementById("subcategory").options[0]=new Option("Please select Wrestler","");
                        document.getElementById("subcategory").options[1]=new Option("Strauts","Strauts");
                        document.getElementById("subcategory").options[2]=new Option("Hibernate","Hibernate");
                        break;
                    case "Junior Varsity" :
                        document.getElementById("subcategory").options[0]=new Option("Please select Wrestler","");
                        document.getElementById("subcategory").options[1]=new Option("Prototype","Prototype");
                        document.getElementById("subcategory").options[2]=new Option("jQuery","jQuery");
                        break;
                    case "Varsity" :
                        document.getElementById("subcategory").options[0]=new Option("Please select Wrestler","");
                        document.getElementById("subcategory").options[1]=new Option("Marc Hendricks","Marc Hendricks");
                        break;
                    default:
                        document.getElementById("subcategory").options[0]=new Option("Please select Wrestler","");
                        break;
                }
                return true;
            }
            
            function dynamicdropdownone(listindex)
            {
                document.getElementById("sub_subcategory").length = 0;
                switch (listindex)
                {
                    case "Wordpress" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("Wordpress Version1","wordpress_version1");
                        document.getElementById("sub_subcategory").options[2]=new Option("Wordpress Version2","wordpress_version2");
                        break;
                    
                    case "Magento" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("Magento Version1","magento_version1");
                        document.getElementById("sub_subcategory").options[2]=new Option("Magento Version2","magento_version2");
                        break;
                    case "Strauts" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("Strauts Version1","strauts_version1");
                        document.getElementById("sub_subcategory").options[2]=new Option("Strauts Version2","strauts_version2");
                        break;
                    
                    case "Hibernate" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("Hibernate Version1","hibernate_version1");
                        document.getElementById("sub_subcategory").options[2]=new Option("Hibernate Version2","hibernate_version2");
                        break;
                    case "Prototype" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("Prototype Version1","prototype_version1");
                        document.getElementById("sub_subcategory").options[2]=new Option("Prototype Version2","prototype_version2");
                        break;
                    
                    case "jQuery" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("jQuery Version1","jquery_version1");
                        document.getElementById("sub_subcategory").options[2]=new Option("jQuery Version2","jquery_version2");
                        break;
                    case "Marc Hendricks" :
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        document.getElementById("sub_subcategory").options[1]=new Option("2013-2014","2013-2014");
                        document.getElementById("sub_subcategory").options[2]=new Option("2014-2015","2014-2015");
                        document.getElementById("sub_subcategory").options[3]=new Option("2015-2016","2015-2016");
                        document.getElementById("sub_subcategory").options[4]=new Option("2016-2017","2016-2017");
                        document.getElementById("sub_subcategory").options[5]=new Option("2017-2018","2017-2018");
                        break;
                    default:
                        document.getElementById("sub_subcategory").options[0]=new Option("Please select Year","");
                        break;
                }
                return true;
            }
       </script>
</head>
<body>
  <div class="sub_category_div" id="sub_category_div">
            <script type="text/javascript" Wrestling Level="JavaScript">
                document.write('<select name="subcategory" id="subcategory" onchange="javascript: dynamicdropdownone(this.options[this.selectedIndex].value);"><option value="">Please select Wrestler</option></select>')
            </script>
            <noscript>
                <select name="subcategory" id="subcategory" >
                    <option value="">Please select Year</option>
                </select>
            </noscript>
        </div>

  <div class="sub_subcategory_div" id="sub_subcategory_div">
            <script type="text/javascript" Wrestling Level="JavaScript">
                document.write('<select name="sub_subcategory" onchange="javascript: urlRedirectTo(this.options[this.selectedIndex].value);" id="sub_subcategory"><option value="">Please select Year</option></select>')
            </script>
            <noscript>
                <select name="sub_subcategory" id="sub_subcategory" >
                    <option value="">Please select Year</option>
                </select>
            </noscript>
        </div>
</body>
</html>

AnswerRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
ZurdoDev4-Oct-19 2:07
professionalZurdoDev4-Oct-19 2:07 
GeneralRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
codeguy14-Oct-19 20:42
Membercodeguy14-Oct-19 20:42 
AnswerRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
ZurdoDev6-Oct-19 9:54
professionalZurdoDev6-Oct-19 9:54 
GeneralRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
codeguy16-Oct-19 17:00
Membercodeguy16-Oct-19 17:00 
QuestionRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
ZurdoDev6-Oct-19 17:29
professionalZurdoDev6-Oct-19 17:29 
AnswerRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
codeguy16-Oct-19 17:47
Membercodeguy16-Oct-19 17:47 
GeneralRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
phil.o6-Oct-19 22:39
mvephil.o6-Oct-19 22:39 
SuggestionRe: How to display a Javascript alert and display a iframe using a javascript dynamic drop-down list Pin
ZurdoDev7-Oct-19 1:56
professionalZurdoDev7-Oct-19 1:56 
QuestionDouble check if array.find result is not undefined and cancel exception, replace with "" Pin
jkirkerx2-Oct-19 11:33
professionaljkirkerx2-Oct-19 11:33 
AnswerRe: Double check if array.find result is not undefined and cancel exception, replace with "" Pin
jkirkerx2-Oct-19 11:40
professionaljkirkerx2-Oct-19 11:40 
QuestionNot sure where my mistake is. . . I want the two texts to turn blue and yellow. Pin
mattkrebs30-Sep-19 9:38
Membermattkrebs30-Sep-19 9:38 
AnswerRe: Not sure where my mistake is. . . I want the two texts to turn blue and yellow. Pin
Nathan Minier30-Sep-19 10:17
professionalNathan Minier30-Sep-19 10:17 
AnswerRe: Not sure where my mistake is. . . I want the two texts to turn blue and yellow. Pin
Richard Deeming30-Sep-19 11:05
mveRichard Deeming30-Sep-19 11:05 
QuestionImporting css classes into React Component Pin
simpledeveloper26-Sep-19 11:47
Membersimpledeveloper26-Sep-19 11:47 
AnswerRe: Importing css classes into React Component Pin
Richard Deeming27-Sep-19 2:35
mveRichard Deeming27-Sep-19 2:35 
GeneralRe: Importing css classes into React Component Pin
simpledeveloper27-Sep-19 7:09
Membersimpledeveloper27-Sep-19 7:09 
GeneralRe: Importing css classes into React Component Pin
Wishe199130-Sep-19 0:25
MemberWishe199130-Sep-19 0:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.