Jump to content

pxxb

Members
  • Posts

    10
  • Joined

  • Last visited

pxxb's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I am fairly new to JavaScript and am looking for some help with a practice website. The website advertises food and when the user clicks the next button, the image of the food, and price change. This is what I have so far, I have an idea on how to go about doing this. Maybe make a loop and every time the button next is pressed increase the array by 1? Any help would be wonderful, thanks. <html> <body> <h1> Amy's Bakery</h1> <h2>Prices at: <span id='price'>$14.99</span</h2> <img id = 'picture' src='images/chocolatecake.jpg' alt='' /> <a href='#' id= 'PrevBtn'>Previous</a> <a href='#' id= 'NextBtn'>Next</a> <div class='desc'> Freshly backed Chocolate Cake </div> <script type='text/javascript'> var dessertArray = Array( { imgSrc : 'images/chocolatecake.jpg', desc : 'Freshly backed chocolate cake.', price : 'price : $14.99' }, { imgSrc : 'images/chocolatemuffin.jpg', desc : 'Delicious chocolate muffin', price : 'price : $2.99' }, { imgSrc : 'images/icecream.jpg', desc : 'Delicious ice cream available in multiple flavours.', price : 'price : $4.99' }, { imgSrc : 'images/cheesecake.jpg', desc : 'Delicious apple cheesecake', price : 'price : $149,999.00' } ); </body> </html>
  2. I have a program that lets the user type in the year and if the year is not numeric or isn't 4 digits it will display an error when user presses submit. I am wondering, how would I make it so the text box gets highlighted if the user types an invalid year? I know it's done through css but that's about all. thanks.
  3. Hi, I have a drop down scroll list and am trying to get it to remember the selection when I submit. Also I wan't to print an error message if they don't select any provinces or if they select a certain province. How would I do that? <legend> Preferences</legend> <label for='formProvinces[]'>Province (Multiple Select) *</label><br> <select size = 12 multiple="multiple" name="formProvinces[] /> <?php foreach ($PROVINCES as $province){ ?> <option value="US"><?php echo $province; ?></option> <?php } ?> </select> -------------------- i was thinking along the lines of this... if (empty($province)){ $error[] = 'Must select atleast one province'; } else if ($province[1]){ $error[] = 'Please select another province'; } how do i keep the memory of the selection after submitting? thanks
  4. Would anyone know why the drop list won't display until I press submit on my page?
  5. Thank you, it worked when I executed it seperately. This code is part of a bigger program that I am working on and for somereason it wont display the $fruits. :\ trying to figure out why haha
  6. Hi, I am trying to make a scroll list that is multi-selectable. I am having trouble generating the scroll list and having the array be in it. I am new to php so any help would be nice. Thank you. $fruits = array( "--" => "---Please Select a Fruit ---", "ap"=>"Apple", "ba"=>"Banana", "ga"=>"Grapes", "wa"=>"Watermelon", "pe"=>"Pear"); <fieldset> <legend> Fruits</legend> <select name = "fruits"> <?php foreach ($fruits as $fruit){ ?> <option value = ""><?php $fruit ?></option> <?php } ?> </select> </fieldset>
  7. So would I do something like: foreach ($animals as $word){ '<span class ="red" >' $animals[2] '</span>' echo $word; That would make only chicken red when printing entire array?
  8. I am trying to display all the contents of the array but I want to make "Chicken" in red font. How can I do this? I am new to Php. TY $animals = array("goat", "pig", "chicken","lion); //array foreach ($animals as $word){ //print all of array echo $word;
×
×
  • 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.