www.webdeveloper.com
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19

Thread: I need help!!!

  1. #16
    Join Date
    Oct 2006
    Posts
    939
    Ok, modified to validate the selections. Adds option to remove items

    HTML Code:
    <html>
    <head>
    <script type="text/javascript">
    
    var orders=new Array();
    
    var hot=['Awakening Mocha','Caffe Mocha','White Mocha','Cappuccino','Caramel Latte','Caffe Latte','Americano','Hot Chai Latte','Hot Chocolate','Espresso','Fresh Brewed Coffee']
    var froz=['Awakening Mocha','Caffe Mocha','Chocolate Creme','Vanilla Creme','Mango Smoothie','Strawberry Sensation Smoothie','Wild Berry Desire Smoothie','Peach Keen Smoothie','Green Apple Smoothie','Superfruit Antiox Smoothie','Frozen Lemonade','Frozen Hot Chocolate']
    
    
    var siz=['Small','Medium','Large']
    var flav=['Almond','Ammaretto','Bavarian Chocolate','Butterscotch','Caramel Pecan','Chocolate Milano','Cinnamon','Egg Nog','French Vanilla','Gingerbread','Irish Creme','Peppermint','Praline','Tiramisu','Toasted Marshmallow','Toasted Walnut','Sugar Free English Toffee','Sugar Free Hazelnut','Sugar Free Irish Creme','Sugar Free Vanilla']
    var mlk=['2% Milk','Skim Milk','Soy Milk']
    
    
    
    function setup(ans) {
    	if(ans=='Hot Bar'){hc='hot';ans=hot}
    	else if(ans=='Frozen Bar'){hc='cold';ans=froz}	
    
    
    
    var txt = '<table><tr>';
    txt += '<td><span>Please select a '+hc+' Drink:</span><br>';
    	txt += '<select name="drink"><option value="">- Please Select -</option>';
    	for(i=0;i<ans.length;i++){txt+='<option value="'+ans[i]+'">'+ans[i]+'</option>';}
    	txt +='</select></td>';
    txt += '<td><select  name="size" size="'+(siz.length+1)+'">   <OPTGROUP label="Size" style="color:red">';
    	for(i=0;i<siz.length;i++){txt+='<option value="'+siz[i]+'">'+siz[i]+'</option>';}
    
    txt +='</OPTGROUP></td></tr><tr><td><span>Please select a flavor shot</span><br>';
    	txt += '<select name="flavor"><option value="">- Please Select -</option>';
    	for(i=0;i<flav.length;i++){txt+='<option value="'+flav[i]+'">'+flav[i]+'</option>';}
    	txt += '</select></td>';
    
    txt +='<td><span>Please select a milk:</span><br>';
    	txt += '<select name="milk"><option value="">- Please Select -</option>';
    	for(i=0;i<mlk.length;i++){txt+='<option value="'+mlk[i]+'">'+mlk[i]+'</option>';}
    	txt += '</select></td>';
    
    txt +='<td><span>More:</span><br><input type="checkbox" name="More" value="" onclick="this.value==\'\'?this.value=\'add Whipped Cream\':this.value=\'\'">Add Whipped Cream </td></tr></table>'
    txt +='<div style="text-align:right"><input type=button onclick="validate()" value="Get it!"></div>'
      document.getElementById('item1').innerHTML=txt
    }
    
    function validate(){	var f=document.getElementsByTagName('select')
    	for(i=0;i<f.length;i++){if(!f[i].value){alert('Select a '+f[i].name); return}}
    addItem('new')
    }
    
    
    function addItem(n){ 	document.getElementById('items').innerHTML='';	var t='';
    	if(n){for(i=0;i<document.forms[0].elements.length-2;i++){t+=''+document.forms[0].elements[i].value+' '}
    	orders.push(t)}
      for(i=0;i<orders.length;i++){
    		var newDiv=document.createElement("div");
    	navigator.appName=='Microsoft Internet Explorer' ? newDiv.setAttribute("className", "order") : newDiv.setAttribute("class", "order" );
    		newDiv.setAttribute("innerHTML",''+orders[i]+'<input type=button onclick="remove('+i+')" value="remove	"><HR>');
    	document.getElementById("items").appendChild(newDiv);
    	}
    }
    
    function remove(x){  orders.splice(x,1);addItem()}
    
    var items=['Panini','Salad','Soup','Beverage','Hot Bar','Frozen Bar']
    function NewItem() {
    	var txt = '<hr color="#008080"><br>'
    	txt +='<select onchange="setup(this.value)" size="'+items.length+'" ><option value="">- Please select -</option>';
    	for(i=0;i<items.length;i++){txt+='<option value="'+items[i]+'">'+items[i]+'</option>';}
    	txt+='</select>'
    return txt + '<p> </p>'
    }
    </script>
    
    
    
    </head>
    <body >
    <table id="order"><tr><td>
    <span style="font-size: 60; font-family: papyrus; font-weight: 900; color: #008080;">&nbsp&nbsp &nbsp Place Order</span>
    </td></tr>
    <tr><td>Thank you for visiting The Awakening Cafe online. Below is an order form to order a delivery or pick-up.
    
    <p></p>
    
    <form action="mailto:muzickid92@suddenlink.net" enctype="text/plain" name="order1" method="post">
    <TABLE><TR><TD id="start">
    	<script type="text/javascript">
    	document.write(NewItem())
    	</script>
    </TD>
    <TD id="item1"></TD></TR></TABLE>
    <div id="items"></div><p> </p>
    
    <input type="submit" value="Submit" /> 
     <input type="reset" value="Reset" />
    </form>
    
    </td>
    </tr>
    </table>
    </body>
    </html>

  2. #17
    Join Date
    Mar 2008
    Posts
    32
    Whats the URL for this site, i am intreaged as to what you have all ready?

  3. #18
    Join Date
    Oct 2006
    Posts
    939
    Sorry, firefox wasn't handling dom like IE and I'm not messing with this anymore today.

    HTML Code:
    <html>
    <head>
    <script type="text/javascript">
    
    var orders=new Array();
    
    var hot=['Awakening Mocha','Caffe Mocha','White Mocha','Cappuccino','Caramel Latte','Caffe Latte','Americano','Hot Chai Latte','Hot Chocolate','Espresso','Fresh Brewed Coffee']
    var froz=['Awakening Mocha','Caffe Mocha','Chocolate Creme','Vanilla Creme','Mango Smoothie','Strawberry Sensation Smoothie','Wild Berry Desire Smoothie','Peach Keen Smoothie','Green Apple Smoothie','Superfruit Antiox Smoothie','Frozen Lemonade','Frozen Hot Chocolate']
    
    
    var siz=['Small','Medium','Large']
    var flav=['Almond','Ammaretto','Bavarian Chocolate','Butterscotch','Caramel Pecan','Chocolate Milano','Cinnamon','Egg Nog','French Vanilla','Gingerbread','Irish Creme','Peppermint','Praline','Tiramisu','Toasted Marshmallow','Toasted Walnut','Sugar Free English Toffee','Sugar Free Hazelnut','Sugar Free Irish Creme','Sugar Free Vanilla']
    var mlk=['2% Milk','Skim Milk','Soy Milk']
    
    
    
    function setup(ans) {
    	if(ans=='Hot Bar'){hc='hot';ans=hot}
    	else if(ans=='Frozen Bar'){hc='cold';ans=froz}	
    
    
    
    var txt = '<table><tr>';
    txt += '<td><span>Please select a '+hc+' Drink:</span><br>';
    	txt += '<select name="drink"><option value="">- Please Select -</option>';
    	for(i=0;i<ans.length;i++){txt+='<option value="'+ans[i]+'">'+ans[i]+'</option>';}
    	txt +='</select></td>';
    txt += '<td><select  name="size" size="'+(siz.length+1)+'">   <OPTGROUP label="Size" style="color:red">';
    	for(i=0;i<siz.length;i++){txt+='<option value="'+siz[i]+'">'+siz[i]+'</option>';}
    
    txt +='</OPTGROUP></td></tr><tr><td><span>Please select a flavor shot</span><br>';
    	txt += '<select name="flavor"><option value="">- Please Select -</option>';
    	for(i=0;i<flav.length;i++){txt+='<option value="'+flav[i]+'">'+flav[i]+'</option>';}
    	txt += '</select></td>';
    
    txt +='<td><span>Please select a milk:</span><br>';
    	txt += '<select name="milk"><option value="">- Please Select -</option>';
    	for(i=0;i<mlk.length;i++){txt+='<option value="'+mlk[i]+'">'+mlk[i]+'</option>';}
    	txt += '</select></td>';
    
    txt +='<td><span>More:</span><br><input type="checkbox" name="More" value="" onclick="this.value==\'\'?this.value=\'add Whipped Cream\':this.value=\'\'">Add Whipped Cream </td></tr></table>'
    txt +='<div style="text-align:right"><input type=button onclick="validate()" value="Get it!"></div>'
      document.getElementById('item1').innerHTML=txt
    }
    
    function validate(){	var f=document.getElementsByTagName('select')
    	for(i=0;i<f.length;i++){if(!f[i].value){alert('Select a '+f[i].name); return}}
    addItem('new')
    }
    
    
    function addItem(n){ 	document.getElementById('items').innerHTML='';	var t='';
    	if(n){ for(i=0;i<document.forms[0].elements.length-2;i++){t+=''+document.forms[0].elements[i].value+' '}
    	orders.push(t);}
    	var ord='';
      for(i=0;i<orders.length;i++){
    		ord+='<div >'+orders[i]+'<input type=button onclick="remove('+i+')" value="remove"></div>';}
    	document.getElementById("items").innerHTML=ord;
    	
    }
    
    function remove(x){  orders.splice(x,1);addItem()}
    
    var items=['Panini','Salad','Soup','Beverage','Hot Bar','Frozen Bar']
    function NewItem() {
    	var txt = '<hr color="#008080"><br>'
    	txt +='<select onchange="setup(this.value)" size="'+items.length+'" ><option value="">- Please select -</option>';
    	for(i=0;i<items.length;i++){txt+='<option value="'+items[i]+'">'+items[i]+'</option>';}
    	txt+='</select>'
    return txt + '<p> </p>'
    }
    </script>
    
    
    
    </head>
    <body >
    <table id="order"><tr><td>
    <span style="font-size: 60; font-family: papyrus; font-weight: 900; color: #008080;">&nbsp&nbsp &nbsp Place Order</span>
    </td></tr>
    <tr><td>Thank you for visiting The Awakening Cafe online. Below is an order form to order a delivery or pick-up.
    
    <p></p>
    
    <form action="mailto:muzickid92@suddenlink.net" enctype="text/plain" name="order1" method="post">
    <TABLE><TR><TD id="start">
    	<script type="text/javascript">
    	document.write(NewItem())
    	</script>
    </TD>
    <TD id="item1"></TD></TR></TABLE>
    <div id="items"></div><p> </p>
    
    <input type="submit" value="Submit" /> 
     <input type="reset" value="Reset" />
    </form>
    
    </td>
    </tr>
    </table>
    </body>
    </html>

  4. #19
    Join Date
    Nov 2009
    Posts
    8
    Quote Originally Posted by spinnykid View Post
    Whats the URL for this site, i am intreaged as to what you have all ready?
    The site isn't online yet. I'll post it once it is.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.16192 seconds
  • Memory Usage 2,902KB
  • Queries Executed 15 (?)
More Information
Template Usage (37):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_html
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (4)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (4)postbit
  • (4)postbit_onlinestatus
  • (4)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (75):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates