/    Sign up×
Community /Pin to ProfileBookmark

select 8×10 not showing up

I have been trying to get the option with 8×10 to show up in page2 in firefox browser.
i have been going over n over a video i got off youtube n theirs nothing i can see that needs changing in code i just want to get 8×10 to be displayed next to you selected: in page2.html here is a pic below with my code.

[code]<!DOCTYPE html>
<html>
<head>
<title>Index</title>
<script>
function passval()
{
var selecttext=document.getElementByid(“mytext”).value;
localStorage.setItem(“ddvalue”,selecttext);
return true;
}
</script>
</head>
<body>
<h1>Photos</h1>
<form action=”./html/page2.html”>
<select id=”mytext”>
<option selected disabled>Photos</option>
<option>8×10 $25</option>
<option>5×7 $10</option>
<option selected disabled>Giftcards</option>
<option>6×4 $4</option>
<option>5×7 $5</option>
</select>
<input type=”submit” value=”submit” onclick=”passval()”>
</form>
</body>
</html>[/code]

page2.html

[code]
<!DOCTYPE html>
<html>
<head>
<title>Page 2</title>
</head>
<body>

you selected:<span id=”results”></span>

<script>
document.getElementByid(“results”).innerHTML=localStorage.getItem(“ddvalue”);
</script>
</body>
</html>
[/code]

[upl-image-preview url=https://www.webdeveloper.com/assets/files/2019-12-10/1576008999-917513-screenshot-741.png]

to post a comment
Full-stack DeveloperJavaScript

38 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumDec 10.2019 — No benefit in opening a new thread for the same subject.

Are cookies/localstorage disabled in your browser? Take a look at the console, does it show any errors?
Copy linkTweet thisAlerts:
@Bigjohn7769authorDec 10.2019 — yes 3 errors but not sure how to fix the more i try more i get confused.... [upl-image-preview url=https://www.webdeveloper.com/assets/files/2019-12-10/1576010450-157608-screenshot-742.png]
Copy linkTweet thisAlerts:
@JMRKERDec 10.2019 — Difficult to read your picture, but best guess would be where you reference the element by

'document.getElementByid...' when it should read 'document.getElementById...'
Copy linkTweet thisAlerts:
@Bigjohn7769authorDec 10.2019 — i changed it but 8x10 is still not showing in page2 i dont know where im going wrong firefox is a pain.

how do i fix so it will work?
Copy linkTweet thisAlerts:
@SempervivumDec 10.2019 — No errors left in the console?
Copy linkTweet thisAlerts:
@Bigjohn7769authorDec 10.2019 — Hi Sempervivum im only getting this message now

The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol.

when i select 8x10.... option why wont it be displayed in page2 in firefox?

If you select option 8x10.... are you getting 8x10 in page2 if you try it?
Copy linkTweet thisAlerts:
@SempervivumDec 10.2019 — If you select option 8x10.... are you getting 8x10 in page2 if you try it?[/quote]Yes I do. This makes it so difficult to find the error.

Does the error occur only for this specific option 8x10 or for any option you select?

I'm fairly shure that the missing char encoding is not the reason for this error. However you can fix it easily by adding

`&lt;meta charset="utf-8" /&gt;`

to your head section. And ensure that you save your HTML files in the same format.
Copy linkTweet thisAlerts:
@Bigjohn7769authorDec 10.2019 — no options goto page 2 next to "you selected:"

i just checked in new tab make sure javascript is still running according to my broswer java is enabled c in pic below so i dont know how to fix it.

[upl-image-preview url=https://www.webdeveloper.com/assets/files/2019-12-10/1576021141-293829-screenshot-745.png]

i was going to use this for my photography website sell my photos but i really need to somehow get this fixed before i can move on n turn page 2 into shopping cart. is there any way you could try fix it n show me pic of say you selected option 8x10 $25 or so n in page2 it will say "You selected: 8x10 $25" etc
Copy linkTweet thisAlerts:
@SempervivumDec 10.2019 — Use the developer tools of Firefox in order to check if the entry is created in local storage:

Ctrl+Shift+I then view the tab "web storage"

And please check if web storage is enabled in your browser. Instructions here:

https://mid.as/kb/00103/enable-disable-or-clear-web-storage-cache
Copy linkTweet thisAlerts:
@Bigjohn7769authorDec 11.2019 — Thankyou sempervivum 4 all help me but i feel like im just wasting time on this im going to youtube maybe theirs something i missed that i just don't understand. i looked in storage up is when index was i looking at the right spot?

it looks like its in localstorage but not in session stroage same in cache storage what do i need to do to fix it?

[upl-image-preview url=https://www.webdeveloper.com/assets/files/2019-12-11/1576024538-656042-screenshot-747.png]
Copy linkTweet thisAlerts:
@Bigjohn7769authorDec 11.2019 — i cant work it out.

could you please do a demo code with 3 options n send it from index page to page2.html needs to work in firefox and send it here working please.

i dont know what else to do. then i could have a go adding more to your demo
Copy linkTweet thisAlerts:
@SempervivumDec 11.2019 — Good news: I was able to reproduce the error. It occurs when
  • 1. the first page is opened without a web server, probably by double click. The URL starts with file:/// then.

    AND

  • 2. page2 is located in a subdirectory, html.

    Can be fixed by opening the first page in a web server. Upload the files to your webspace and try again.
  • Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 13.2019 — hi someone posted a demo for me thankyou but the page has moved i cannot see your demo sorry i wasn't on this site yesterday etc.

    can someone please redo a demo on sending one of these prices to another page using localstorage in JavaScript using these options below n source code please.
    [code]
    <h1>Photos</h1>
    <form action="./html/page2.html">
    <select id="mytext">
    <option disabled>Photos</option>
    <option>8x10 $25</option>
    <option>5x7 $10</option>
    <option disabled>Giftcards</option>
    <option>6x4 $4</option>
    <option>5x7 $5</option>
    </select>
    <input type="submit" value="submit" onclick="passval()">
    </form>
    [code]
    im only asking because im going to use this options for selling my photos online etc.

    also thankyou to everyone else for helping me.
    Copy linkTweet thisAlerts:
    @SempervivumDec 13.2019 — No need for a demo, your code is fine. Did you read my posting? Test it on your webserver and it should work fine. If not, post the URL so that we can view it live.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 13.2019 — this is the actual website im making im editing the code but this is the actual problem after selection option price not showing online but show random price not run in webhosting service how do i fix it link below

    https://testingwebsite999.000webhostapp.com/ im going in circles not knowing what.......
    Copy linkTweet thisAlerts:
    @SempervivumDec 14.2019 — Take a look at the console, it says:
    Mixed Content: The page at 'https://testingwebsite999.000webhostapp.com/' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=PT+Serif:400,700,400italic'. This request has been blocked; the content must be served over HTTPS.

    (index):1 Mixed Content: The page at 'https://testingwebsite999.000webhostapp.com/' was loaded over HTTPS, but requested an insecure script 'http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js'. This request has been blocked; the content must be served over HTTPS.

    jquery.shop.js:647 Uncaught ReferenceError: jQuery is not defined

    at jquery.shop.js:647[/quote]

    You need to load the stylesheet and jQuery over https.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 15.2019 — without saying too much i got rid most error but can you look at debugger in https://testingwebsite999.000webhostapp.com/ in the jquery.shop.js line 603:25 what am i missing? i changed it 3 times nothing i did fixed it
    Copy linkTweet thisAlerts:
    @SempervivumDec 16.2019 — Line 603 reads:

    `saveFormData: function("form") {`

    A string is not possible inside the parenthesises, has to be a parameter name. Omit the double quotes.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 17.2019 — not sure what to use i refresh to something else for awhile.... is it possible maybe i might understand localstorage to send the selected option from page 1 and pass it to page 2 can u help me with the basic code so i can practice a good working code please if it could be 3 answers and the one selected goto page 2 please help i cant find any good source code....
    Copy linkTweet thisAlerts:
    @JMRKERDec 17.2019 — Not exactly sure why you need to pass information from one page to another, but if that is a requirement then why don't you send the information via the command line? You should be able to incorporate the following two scripts into your two separate files. You will need to substitute your path to page #2 in the passval() function of page #1 if they are not in the same directories. Use the encodeURI() and decodeURI() functions if needed for your server.

    testPage1.html
    <i>
    </i>&lt;!DOCTYPE html&gt;&lt;html lang="en"&gt;&lt;head&gt;&lt;title&gt; Test Page 1&lt;/title&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width-device-width,initial-scale=1.0, user-scalable=yes"/&gt;
    &lt;!-- For: https://www.webdeveloper.com/d/387004-need-help-with-code-below --&gt;
    &lt;/head&gt;&lt;body&gt;

    &lt;h1&gt;Photos&lt;/h1&gt;
    &lt;select id='sbox'&gt;
    &lt;optgroup label="Photos"&gt;
    &lt;option value="8x10 $25"&gt; 8x10 $25 &lt;/option&gt;
    &lt;option value="5x7 $10"&gt; 5x7 $10 &lt;/option&gt;
    &lt;/optgroup&gt;
    &lt;optgroup label="Giftcards"&gt;
    &lt;option value="6x4 $4"&gt; 6x4 $4 &lt;/option&gt;
    &lt;option value="5x7 $5"&gt; 5x7 $5 &lt;/option&gt;
    &lt;/optgroup&gt;
    &lt;/select&gt;
    &lt;input type="button" value="submit" onclick="passval()"&gt;

    &lt;script&gt;
    function passval() {
    let info = document.getElementById('sbox').value;
    let uri = './pathto/testPage2.html?info='+info;
    // let uri_enc = encodeURI(uri);
    // following opens existing site
    // var x = window.open(uri_enc,"","top=50,left=100,height=250,width=350");
    var x = window.open(uri,""); // ,"top=50,left=100,height=250,width=350");
    }
    &lt;/script&gt;

    &lt;/body&gt;&lt;/html&gt;


    testPage2.html
    <i>
    </i>&lt;!DOCTYPE html&gt;&lt;html lang="en"&gt;&lt;head&gt;&lt;title&gt; Test Page 2&lt;/title&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width-device-width,initial-scale=1.0, user-scalable=yes"/&gt;
    &lt;!-- For: https://www.webdeveloper.com/d/387004-need-help-with-code-below --&gt;
    &lt;style&gt;

    &lt;/style&gt;

    &lt;/head&gt;&lt;body&gt;

    &lt;h1&gt; Information passed from Test Page 2&lt;/title&gt;
    &lt;div id="info"&gt;&lt;/div&gt;
    &lt;script&gt;
    // https://gomakethings.com/how-to-get-the-value-of-a-querystring-with-native-javascript/
    /**
    * Get the value of a querystring
    * @param {String} field The field to get the value of
    * @param {String} url The URL to get the value from (optional)
    * @return {String} The field value
    */
    var getQueryString = function ( field, url ) {
    var href = url ? url : window.location.href;
    var reg = new RegExp( '[?&amp;]' + field + '=([^&amp;#]*)', 'i' );
    var string = reg.exec(href);
    return string ? string[1] : null;
    };

    function init() {
    var passedInformation = getQueryString('info');
    let uri_dec = decodeURI(passedInformation);
    alert(passedInformation+'n'+uri_dec);
    document.getElementById('info').innerHTML = passedInformation +'&lt;br&gt;'+uri_dec;
    }
    init();
    &lt;/script&gt;

    &lt;/body&gt;&lt;/html&gt;

    Remove the alert(), used here only for testing purposes.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 18.2019 — the reason i want it to value to another page im going to try and turn it into a shopping cart later on as the code above i copied source code word for word from a video i saw on YouTube n etc wow im really happy now your works now i even was able to edit your code i worked most of it out in half hr know i know my my browser not blocking js.. Im making a Photography website where i going to sell my Postcards and gift-cards and enlarged photos for sale etc now this is working i can now experiment with this code to be honest i was starting to think i never would get this done one of mates said keep asking what you don't understand and someone will help soon etc. so i thought if i learn in small steps now ill soon archive my goal creating photography sale website.

    Thankyou JMRKER.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 18.2019 — JMRKER could i ask for one more thing n i wont ask anymore i really keen to learn but im trying to make say another one their was only 1 of three options goes to page2 but instead what i ment was that it stays on same tab but goes to page to not in a new tab sorry. also how would i add it to a shopping cart that calculates all selected options say i want to buy 2 images and the shopping cart adds up cost of 2 would that be too much too ask if you did the first 2 so I could try and work out how add another. example if i selected option 1 = 6x4 = shopping cart starts at $4 then then adding another option save cart 5x7 = shopping cart total = $9 etc. i had ago at changig your code i get far as 7 times before i grind to a halt = not able to grip shopping cart side.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 18.2019 — or how would this code work it wanst working before but your code worked......
    <i>
    </i>(function( $ ) {
    $.Shop = function( element ) {
    this.$element = $( element );
    this.init();
    };

    <i> </i>$.Shop.prototype = {
    <i> </i> init: function() {
    <i> </i>
    <i> </i> // Properties
    <i> </i>
    <i> </i> this.cartPrefix = "winery-"; // Prefix string to be prepended to the cart's name in the session storage
    <i> </i> this.cartName = this.cartPrefix + "cart"; // Cart name in the session storage
    <i> </i> this.shippingRates = this.cartPrefix + "shipping-rates"; // Shipping rates key in the session storage
    <i> </i> this.total = this.cartPrefix + "total"; // Total key in the session storage
    <i> </i> this.storage = sessionStorage; // shortcut to the sessionStorage object
    <i> </i>
    <i> </i>
    <i> </i> this.$formAddToCart = this.$element.find( "form.add-to-cart" ); // Forms for adding items to the cart
    <i> </i> this.$formCart = this.$element.find( "#shopping-cart" ); // Shopping cart form
    <i> </i> this.$checkoutCart = this.$element.find( "#checkout-cart" ); // Checkout form cart
    <i> </i> this.$checkoutOrderForm = this.$element.find( "#checkout-order-form" ); // Checkout user details form
    <i> </i> this.$shipping = this.$element.find( "#sshipping" ); // Element that displays the shipping rates
    <i> </i> this.$subTotal = this.$element.find( "#stotal" ); // Element that displays the subtotal charges
    <i> </i> this.$shoppingCartActions = this.$element.find( "#shopping-cart-actions" ); // Cart actions links
    <i> </i> this.$updateCartBtn = this.$shoppingCartActions.find( "#update-cart" ); // Update cart button
    <i> </i> this.$emptyCartBtn = this.$shoppingCartActions.find( "#empty-cart" ); // Empty cart button
    <i> </i> this.$userDetails = this.$element.find( "#user-details-content" ); // Element that displays the user information
    <i> </i> this.$paypalForm = this.$element.find( "#paypal-form" ); // PayPal form
    <i> </i>
    <i> </i>
    <i> </i> this.currency = "&amp;euro;"; // HTML entity of the currency to be displayed in the layout
    <i> </i> this.currencyString = "€"; // Currency symbol as textual string
    <i> </i> this.paypalCurrency = "EUR"; // PayPal's currency code
    <i> </i> this.paypalBusinessEmail = "[email protected]"; // Your Business PayPal's account email address
    <i> </i> this.paypalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr"; // The URL of the PayPal's form
    <i> </i>
    <i> </i> // Object containing patterns for form validation
    <i> </i> this.requiredFields = {
    <i> </i> expression: {
    <i> </i> value: /^([w-.]+)@((?:[w]+.)+)([a-z]){2,4}$/
    <i> </i> },
    <i> </i>
    <i> </i> str: {
    <i> </i> value: ""
    <i> </i> }
    <i> </i>
    <i> </i> };
    <i> </i>
    <i> </i> // Method invocation
    <i> </i>
    <i> </i> this.createCart();
    <i> </i> this.handleAddToCartForm();
    <i> </i> this.handleCheckoutOrderForm();
    <i> </i> this.emptyCart();
    <i> </i> this.updateCart();
    <i> </i> this.displayCart();
    <i> </i> this.deleteProduct();
    <i> </i> this.displayUserDetails();
    <i> </i> this.populatePayPalForm();
    <i> </i>
    <i> </i>
    <i> </i> },
    <i> </i>
    <i> </i> // Public methods
    <i> </i>
    <i> </i> // Creates the cart keys in the session storage
    <i> </i>
    <i> </i> createCart: function() {
    <i> </i> if( this.storage.getItem( this.cartName ) == null ) {
    <i> </i>
    <i> </i> var cart = {};
    <i> </i> cart.items = [];
    <i> </i>
    <i> </i> this.storage.setItem( this.cartName, this._toJSONString( cart ) );
    <i> </i> this.storage.setItem( this.shippingRates, "0" );
    <i> </i> this.storage.setItem( this.total, "0" );
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Appends the required hidden values to the PayPal's form before submitting
    <i> </i>
    <i> </i> populatePayPalForm: function() {
    <i> </i> var self = this;
    <i> </i> if( self.$paypalForm.length ) {
    <i> </i> var $form = self.$paypalForm;
    <i> </i> var cart = self._toJSONObject( self.storage.getItem( self.cartName ) );
    <i> </i> var shipping = self.storage.getItem( self.shippingRates );
    <i> </i> var numShipping = self._convertString( shipping );
    <i> </i> var cartItems = cart.items;
    <i> </i> var singShipping = Math.floor( numShipping / cartItems.length );
    <i> </i>
    <i> </i> $form.attr( "action", self.paypalURL );
    <i> </i> $form.find( "input[name='business']" ).val( self.paypalBusinessEmail );
    <i> </i> $form.find( "input[name='currency_code']" ).val( self.paypalCurrency );
    <i> </i>
    <i> </i> for( var i = 0; i &lt; cartItems.length; ++i ) {
    <i> </i> var cartItem = cartItems[i];
    <i> </i> var n = i + 1;
    <i> </i> var name = cartItem.product;
    <i> </i> var price = cartItem.price;
    <i> </i> var qty = cartItem.qty;
    <i> </i>
    <i> </i> $( "&lt;div/&gt;" ).html( "&lt;input type='hidden' name='quantity_" + n + "' value='" + qty + "'/&gt;" ).
    <i> </i> insertBefore( "#paypal-btn" );
    <i> </i> $( "&lt;div/&gt;" ).html( "&lt;input type='hidden' name='item_name_" + n + "' value='" + name + "'/&gt;" ).
    <i> </i> insertBefore( "#paypal-btn" );
    <i> </i> $( "&lt;div/&gt;" ).html( "&lt;input type='hidden' name='item_number_" + n + "' value='SKU " + name + "'/&gt;" ).
    <i> </i> insertBefore( "#paypal-btn" );
    <i> </i> $( "&lt;div/&gt;" ).html( "&lt;input type='hidden' name='amount_" + n + "' value='" + self._formatNumber( price, 2 ) + "'/&gt;" ).
    <i> </i> insertBefore( "#paypal-btn" );
    <i> </i> $( "&lt;div/&gt;" ).html( "&lt;input type='hidden' name='shipping_" + n + "' value='" + self._formatNumber( singShipping, 2 ) + "'/&gt;" ).
    <i> </i> insertBefore( "#paypal-btn" );
    <i> </i>
    <i> </i> }
    <i> </i>
    <i> </i>
    <i> </i>
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Displays the user's information
    <i> </i>
    <i> </i> displayUserDetails: function() {
    <i> </i> if( this.$userDetails.length ) {
    <i> </i> if( this.storage.getItem( "shipping-name" ) == null ) {
    <i> </i> var name = this.storage.getItem( "billing-name" );
    <i> </i> var email = this.storage.getItem( "billing-email" );
    <i> </i> var city = this.storage.getItem( "billing-city" );
    <i> </i> var address = this.storage.getItem( "billing-address" );
    <i> </i> var zip = this.storage.getItem( "billing-zip" );
    <i> </i> var country = this.storage.getItem( "billing-country" );
    <i> </i>
    <i> </i> var html = "&lt;div class='detail'&gt;";
    <i> </i> html += "&lt;h2&gt;Billing and Shipping&lt;/h2&gt;";
    <i> </i> html += "&lt;ul&gt;";
    <i> </i> html += "&lt;li&gt;" + name + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + email + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + city + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + address + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + zip + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + country + "&lt;/li&gt;";
    <i> </i> html += "&lt;/ul&gt;&lt;/div&gt;";
    <i> </i>
    <i> </i> this.$userDetails[0].innerHTML = html;
    <i> </i> } else {
    <i> </i> var name = this.storage.getItem( "billing-name" );
    <i> </i> var email = this.storage.getItem( "billing-email" );
    <i> </i> var city = this.storage.getItem( "billing-city" );
    <i> </i> var address = this.storage.getItem( "billing-address" );
    <i> </i> var zip = this.storage.getItem( "billing-zip" );
    <i> </i> var country = this.storage.getItem( "billing-country" );
    <i> </i>
    <i> </i> var sName = this.storage.getItem( "shipping-name" );
    <i> </i> var sEmail = this.storage.getItem( "shipping-email" );
    <i> </i> var sCity = this.storage.getItem( "shipping-city" );
    <i> </i> var sAddress = this.storage.getItem( "shipping-address" );
    <i> </i> var sZip = this.storage.getItem( "shipping-zip" );
    <i> </i> var sCountry = this.storage.getItem( "shipping-country" );
    <i> </i>
    <i> </i> var html = "&lt;div class='detail'&gt;";
    <i> </i> html += "&lt;h2&gt;Billing&lt;/h2&gt;";
    <i> </i> html += "&lt;ul&gt;";
    <i> </i> html += "&lt;li&gt;" + name + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + email + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + city + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + address + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + zip + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + country + "&lt;/li&gt;";
    <i> </i> html += "&lt;/ul&gt;&lt;/div&gt;";
    <i> </i>
    <i> </i> html += "&lt;div class='detail right'&gt;";
    <i> </i> html += "&lt;h2&gt;Shipping&lt;/h2&gt;";
    <i> </i> html += "&lt;ul&gt;";
    <i> </i> html += "&lt;li&gt;" + sName + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + sEmail + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + sCity + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + sAddress + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + sZip + "&lt;/li&gt;";
    <i> </i> html += "&lt;li&gt;" + sCountry + "&lt;/li&gt;";
    <i> </i> html += "&lt;/ul&gt;&lt;/div&gt;";
    <i> </i>
    <i> </i> this.$userDetails[0].innerHTML = html;
    <i> </i>
    <i> </i> }
    <i> </i> }
    <i> </i> },

    <i> </i> // Delete a product from the shopping cart

    <i> </i> deleteProduct: function() {
    <i> </i> var self = this;
    <i> </i> if( self.$formCart.length ) {
    <i> </i> var cart = this._toJSONObject( this.storage.getItem( this.cartName ) );
    <i> </i> var items = cart.items;

    <i> </i> $( document ).on( "click", ".pdelete a", function( e ) {
    <i> </i> e.preventDefault();
    <i> </i> var productName = $( this ).data( "product" );
    <i> </i> var newItems = [];
    <i> </i> for( var i = 0; i &lt; items.length; ++i ) {
    <i> </i> var item = items[i];
    <i> </i> var product = item.product;
    <i> </i> if( product == productName ) {
    <i> </i> items.splice( i, 1 );
    <i> </i> }
    <i> </i> }
    <i> </i> newItems = items;
    <i> </i> var updatedCart = {};
    <i> </i> updatedCart.items = newItems;

    <i> </i> var updatedTotal = 0;
    <i> </i> var totalQty = 0;
    <i> </i> if( newItems.length == 0 ) {
    <i> </i> updatedTotal = 0;
    <i> </i> totalQty = 0;
    <i> </i> } else {
    <i> </i> for( var j = 0; j &lt; newItems.length; ++j ) {
    <i> </i> var prod = newItems[j];
    <i> </i> var sub = prod.price * prod.qty;
    <i> </i> updatedTotal += sub;
    <i> </i> totalQty += prod.qty;
    <i> </i> }
    <i> </i> }

    <i> </i> self.storage.setItem( self.total, self._convertNumber( updatedTotal ) );
    <i> </i> self.storage.setItem( self.shippingRates, self._convertNumber( self._calculateShipping( totalQty ) ) );

    <i> </i> self.storage.setItem( self.cartName, self._toJSONString( updatedCart ) );
    <i> </i> $( this ).parents( "tr" ).remove();
    <i> </i> self.$subTotal[0].innerHTML = self.currency + " " + self.storage.getItem( self.total );
    <i> </i> });
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Displays the shopping cart
    <i> </i>
    <i> </i> displayCart: function() {
    <i> </i> if( this.$formCart.length ) {
    <i> </i> var cart = this._toJSONObject( this.storage.getItem( this.cartName ) );
    <i> </i> var items = cart.items;
    <i> </i> var $tableCart = this.$formCart.find( ".shopping-cart" );
    <i> </i> var $tableCartBody = $tableCart.find( "tbody" );

    <i> </i> if( items.length == 0 ) {
    <i> </i> $tableCartBody.html( "" );
    <i> </i> } else {
    <i> </i>
    <i> </i>
    <i> </i> for( var i = 0; i &lt; items.length; ++i ) {
    <i> </i> var item = items[i];
    <i> </i> var product = item.product;
    <i> </i> var price = this.currency + " " + item.price;
    <i> </i> var qty = item.qty;
    <i> </i> var html = "&lt;tr&gt;&lt;td class='pname'&gt;" + product + "&lt;/td&gt;" + "&lt;td class='pqty'&gt;&lt;input type='text' value='" + qty + "' class='qty'/&gt;&lt;/td&gt;";
    <i> </i> html += "&lt;td class='pprice'&gt;" + price + "&lt;/td&gt;&lt;td class='pdelete'&gt;&lt;a href='' data-product='" + product + "'&gt;&amp;times;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;";
    <i> </i>
    <i> </i> $tableCartBody.html( $tableCartBody.html() + html );
    <i> </i> }

    <i> </i> }

    <i> </i> if( items.length == 0 ) {
    <i> </i> this.$subTotal[0].innerHTML = this.currency + " " + 0.00;
    <i> </i> } else {
    <i> </i>
    <i> </i> var total = this.storage.getItem( this.total );
    <i> </i> this.$subTotal[0].innerHTML = this.currency + " " + total;
    <i> </i> }
    <i> </i> } else if( this.$checkoutCart.length ) {
    <i> </i> var checkoutCart = this._toJSONObject( this.storage.getItem( this.cartName ) );
    <i> </i> var cartItems = checkoutCart.items;
    <i> </i> var $cartBody = this.$checkoutCart.find( "tbody" );

    <i> </i> if( cartItems.length &gt; 0 ) {
    <i> </i>
    <i> </i> for( var j = 0; j &lt; cartItems.length; ++j ) {
    <i> </i> var cartItem = cartItems[j];
    <i> </i> var cartProduct = cartItem.product;
    <i> </i> var cartPrice = this.currency + " " + cartItem.price;
    <i> </i> var cartQty = cartItem.qty;
    <i> </i> var cartHTML = "&lt;tr&gt;&lt;td class='pname'&gt;" + cartProduct + "&lt;/td&gt;" + "&lt;td class='pqty'&gt;" + cartQty + "&lt;/td&gt;" + "&lt;td class='pprice'&gt;" + cartPrice + "&lt;/td&gt;&lt;/tr&gt;";
    <i> </i>
    <i> </i> $cartBody.html( $cartBody.html() + cartHTML );
    <i> </i> }
    <i> </i> } else {
    <i> </i> $cartBody.html( "" );
    <i> </i> }

    <i> </i> if( cartItems.length &gt; 0 ) {
    <i> </i>
    <i> </i> var cartTotal = this.storage.getItem( this.total );
    <i> </i> var cartShipping = this.storage.getItem( this.shippingRates );
    <i> </i> var subTot = this._convertString( cartTotal ) + this._convertString( cartShipping );
    <i> </i>
    <i> </i> this.$subTotal[0].innerHTML = this.currency + " " + this._convertNumber( subTot );
    <i> </i> this.$shipping[0].innerHTML = this.currency + " " + cartShipping;
    <i> </i> } else {
    <i> </i> this.$subTotal[0].innerHTML = this.currency + " " + 0.00;
    <i> </i> this.$shipping[0].innerHTML = this.currency + " " + 0.00;
    <i> </i> }
    <i> </i>
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Empties the cart by calling the _emptyCart() method
    <i> </i> // @see $.Shop._emptyCart()
    <i> </i>
    <i> </i> emptyCart: function() {
    <i> </i> var self = this;
    <i> </i> if( self.$emptyCartBtn.length ) {
    <i> </i> self.$emptyCartBtn.on( "click", function() {
    <i> </i> self._emptyCart();
    <i> </i> });
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Updates the cart
    <i> </i>
    <i> </i> updateCart: function() {
    <i> </i> var self = this;
    <i> </i> if( self.$updateCartBtn.length ) {
    <i> </i> self.$updateCartBtn.on( "click", function() {
    <i> </i> var $rows = self.$formCart.find( "tbody tr" );
    <i> </i> var cart = self.storage.getItem( self.cartName );
    <i> </i> var shippingRates = self.storage.getItem( self.shippingRates );
    <i> </i> var total = self.storage.getItem( self.total );
    <i> </i>
    <i> </i> var updatedTotal = 0;
    <i> </i> var totalQty = 0;
    <i> </i> var updatedCart = {};
    <i> </i> updatedCart.items = [];
    <i> </i>
    <i> </i> $rows.each(function() {
    <i> </i> var $row = $( this );
    <i> </i> var pname = $.trim( $row.find( ".pname" ).text() );
    <i> </i> var pqty = self._convertString( $row.find( ".pqty &gt; .qty" ).val() );
    <i> </i> var pprice = self._convertString( self._extractPrice( $row.find( ".pprice" ) ) );
    <i> </i>
    <i> </i> var cartObj = {
    <i> </i> product: pname,
    <i> </i> price: pprice,
    <i> </i> qty: pqty
    <i> </i> };
    <i> </i>
    <i> </i> updatedCart.items.push( cartObj );
    <i> </i>
    <i> </i> var subTotal = pqty * pprice;
    <i> </i> updatedTotal += subTotal;
    <i> </i> totalQty += pqty;
    <i> </i> });
    <i> </i>
    <i> </i> self.storage.setItem( self.total, self._convertNumber( updatedTotal ) );
    <i> </i> self.storage.setItem( self.shippingRates, self._convertNumber( self._calculateShipping( totalQty ) ) );
    <i> </i> self.storage.setItem( self.cartName, self._toJSONString( updatedCart ) );
    <i> </i>
    <i> </i> });
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Adds items to the shopping cart
    <i> </i>
    <i> </i> handleAddToCartForm: function() {
    <i> </i> var self = this;
    <i> </i> self.$formAddToCart.each(function() {
    <i> </i> var $form = $( this );
    <i> </i> var $product = $form.parent();
    <i> </i> var price = self._convertString( $product.data( "price" ) );
    <i> </i> var name = $product.data( "name" );
    <i> </i>
    <i> </i> $form.on( "submit", function() {
    <i> </i> var qty = self._convertString( $form.find( ".qty" ).val() );
    <i> </i> var subTotal = qty * price;
    <i> </i> var total = self._convertString( self.storage.getItem( self.total ) );
    <i> </i> var sTotal = total + subTotal;
    <i> </i> self.storage.setItem( self.total, sTotal );
    <i> </i> self._addToCart({
    <i> </i> product: name,
    <i> </i> price: price,
    <i> </i> qty: qty
    <i> </i> });
    <i> </i> var shipping = self._convertString( self.storage.getItem( self.shippingRates ) );
    <i> </i> var shippingRates = self._calculateShipping( qty );
    <i> </i> var totalShipping = shipping + shippingRates;
    <i> </i>
    <i> </i> self.storage.setItem( self.shippingRates, totalShipping );
    <i> </i> });
    <i> </i> });
    <i> </i> },
    <i> </i>
    <i> </i> // Handles the checkout form by adding a validation routine and saving user's info into the session storage
    <i> </i>
    <i> </i> handleCheckoutOrderForm: function() {
    <i> </i> var self = this;
    <i> </i> if( self.$checkoutOrderForm.length ) {
    <i> </i> var $sameAsBilling = $( "#same-as-billing" );
    <i> </i> $sameAsBilling.on( "change", function() {
    <i> </i> var $check = $( this );
    <i> </i> if( $check.prop( "checked" ) ) {
    <i> </i> $( "#fieldset-shipping" ).slideUp( "normal" );
    <i> </i> } else {
    <i> </i> $( "#fieldset-shipping" ).slideDown( "normal" );
    <i> </i> }
    <i> </i> });
    <i> </i>
    <i> </i> self.$checkoutOrderForm.on( "submit", function() {
    <i> </i> var $form = $( this );
    <i> </i> var valid = self._validateForm( $form );
    <i> </i>
    <i> </i> if( !valid ) {
    <i> </i> return valid;
    <i> </i> } else {
    <i> </i> self._saveFormData( $form );
    <i> </i> }
    <i> </i> });
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> // Private methods
    <i> </i>
    <i> </i>
    <i> </i> // Empties the session storage
    <i> </i>
    <i> </i> _emptyCart: function() {
    <i> </i> this.storage.clear();
    <i> </i> },
    <i> </i>
    <i> </i> /* Format a number by decimal places
    <i> </i> * @param num Number the number to be formatted
    <i> </i> * @param places Number the decimal places
    <i> </i> * @returns n Number the formatted number
    <i> </i> */
    <i> </i>
    <i> </i>
    <i> </i>
    <i> </i> _formatNumber: function( num, places ) {
    <i> </i> var n = num.toFixed( places );
    <i> </i> return n;
    <i> </i> },
    <i> </i>
    <i> </i> /* Extract the numeric portion from a string
    <i> </i> * @param element Object the jQuery element that contains the relevant string
    <i> </i> * @returns price String the numeric string
    <i> </i> */
    <i> </i>
    <i> </i>
    <i> </i> _extractPrice: function( element ) {
    <i> </i> var self = this;
    <i> </i> var text = element.text();
    <i> </i> var price = text.replace( self.currencyString, "" ).replace( " ", "" );
    <i> </i> return price;
    <i> </i> },
    <i> </i>
    <i> </i> /* Converts a numeric string into a number
    <i> </i> * @param numStr String the numeric string to be converted
    <i> </i> * @returns num Number the number
    <i> </i> */
    <i> </i>
    <i> </i> _convertString: function( numStr ) {
    <i> </i> var num;
    <i> </i> if( /^[-+]?[0-9]+.[0-9]+$/.test( numStr ) ) {
    <i> </i> num = parseFloat( numStr );
    <i> </i> } else if( /^d+$/.test( numStr ) ) {
    <i> </i> num = parseInt( numStr, 10 );
    <i> </i> } else {
    <i> </i> num = Number( numStr );
    <i> </i> }
    <i> </i>
    <i> </i> if( !isNaN( num ) ) {
    <i> </i> return num;
    <i> </i> } else {
    <i> </i> console.warn( numStr + " cannot be converted into a number" );
    <i> </i> return false;
    <i> </i> }
    <i> </i> },
    <i> </i>
    <i> </i> /* Converts a number to a string
    <i> </i> * @param n Number the number to be converted
    <i> </i> * @returns str String the string returned
    <i> </i> */
    <i> </i>
    <i> </i> _convertNumber: function( n ) {
    <i> </i> var str = n.toString();
    <i> </i> return str;
    <i> </i> },
    <i> </i>
    <i> </i> /* Converts a JSON string to a JavaScript object
    <i> </i> * @param str String the JSON string
    <i> </i> * @returns obj Object the JavaScript object
    <i> </i> */
    <i> </i>
    <i> </i> _toJSONObject: function( str ) {
    <i> </i> var obj = JSON.parse( str );
    <i> </i> return obj;
    <i> </i> },
    <i> </i>
    <i> </i> /* Converts a JavaScript object to a JSON string
    <i> </i> * @param obj Object the JavaScript object
    <i> </i> * @returns str String the JSON string
    <i> </i> */
    <i> </i>
    <i> </i>
    <i> </i> _toJSONString: function( obj ) {
    <i> </i> var str = JSON.stringify( obj );
    <i> </i> return str;
    <i> </i> },
    <i> </i>
    <i> </i>
    <i> </i> /* Add an object to the cart as a JSON string
    <i> </i> * @param values Object the object to be added to the cart
    <i> </i> * @returns void
    <i> </i> */
    <i> </i>
    <i> </i>
    <i> </i> _addToCart: function( values ) {
    <i> </i> var cart = this.storage.getItem( this.cartName );
    <i> </i>
    <i> </i> var cartObject = this._toJSONObject( cart );
    <i> </i> var cartCopy = cartObject;
    <i> </i> var items = cartCopy.items;
    <i> </i> items.push( values );
    <i> </i>
    <i> </i> this.storage.setItem( this.cartName, this._toJSONString( cartCopy ) );
    <i> </i> },
    <i> </i>
    <i> </i> /* Custom shipping rates calculation based on the total quantity of items in the cart
    <i> </i> * @param qty Number the total quantity of items
    <i> </i> * @returns shipping Number the shipping rates
    <i> </i> */
    <i> </i>
    <i> </i> _calculateShipping: function( qty ) {
    <i> </i> var shipping = 0;
    <i> </i> if( qty &gt;= 6 ) {
    <i> </i> shipping = 10;
    <i> </i> }
    <i> </i> if( qty &gt;= 12 &amp;&amp; qty &lt;= 30 ) {
    <i> </i> shipping = 20;
    <i> </i> }
    <i> </i>
    <i> </i> if( qty &gt;= 30 &amp;&amp; qty &lt;= 60 ) {
    <i> </i> shipping = 30;
    <i> </i> }
    <i> </i>
    <i> </i> if( qty &gt; 60 ) {
    <i> </i> shipping = 0;
    <i> </i> }
    <i> </i>
    <i> </i> return shipping;
    <i> </i>
    <i> </i> },
    <i> </i>
    <i> </i> /* Validates the checkout form
    <i> </i> * @param form Object the jQuery element of the checkout form
    <i> </i> * @returns valid Boolean true for success, false for failure
    <i> </i> */
    <i> </i>
    <i> </i>
    <i> </i>
    <i> </i> _validateForm: function( form ) {
    <i> </i> var self = this;
    <i> </i> var fields = self.requiredFields;
    <i> </i> var $visibleSet = form.find( "fieldset:visible" );
    <i> </i> var valid = true;
    <i> </i>
    <i> </i> form.find( ".message" ).remove();
    <i> </i>
    <i> </i> $visibleSet.each(function() {
    <i> </i>
    <i> </i> $( this ).find( ":input" ).each(function() {
    <i> </i> var $input = $( this );
    <i> </i> var type = $input.data( "type" );
    <i> </i> var msg = $input.data( "message" );
    <i> </i>
    <i> </i> if( type == "string" ) {
    <i> </i> if( $input.val() == fields.str.value ) {
    <i> </i> $( "&lt;span class='message'/&gt;" ).text( msg ).
    <i> </i> insertBefore( $input );
    <i> </i>
    <i> </i> valid = false;
    <i> </i> }
    <i> </i> } else {
    <i> </i> if( !fields.expression.value.test( $input.val() ) ) {
    <i> </i> $( "&lt;span class='message'/&gt;" ).text( msg ).
    <i> </i> insertBefore( $input );
    <i> </i>
    <i> </i> valid = false;
    <i> </i> }
    <i> </i> }
    <i> </i>
    <i> </i> });
    <i> </i> });
    <i> </i>
    <i> </i> return valid;
    <i> </i>
    <i> </i> },
    <i> </i>
    <i> </i> /* Save the data entered by the user in the ckeckout form
    <i> </i> * @param form Object the jQuery element of the checkout form
    <i> </i> * @returns void
    <i> </i> */
    <i> </i>
    <i> </i>
    <i> </i> _saveFormData: function( form ) {
    <i> </i> var self = this;
    <i> </i> var $visibleSet = form.find( "fieldset:visible" );
    <i> </i>
    <i> </i> $visibleSet.each(function() {
    <i> </i> var $set = $( this );
    <i> </i> if( $set.is( "#fieldset-billing" ) ) {
    <i> </i> var name = $( "#name", $set ).val();
    <i> </i> var email = $( "#email", $set ).val();
    <i> </i> var city = $( "#city", $set ).val();
    <i> </i> var address = $( "#address", $set ).val();
    <i> </i> var zip = $( "#zip", $set ).val();
    <i> </i> var country = $( "#country", $set ).val();
    <i> </i>
    <i> </i> self.storage.setItem( "billing-name", name );
    <i> </i> self.storage.setItem( "billing-email", email );
    <i> </i> self.storage.setItem( "billing-city", city );
    <i> </i> self.storage.setItem( "billing-address", address );
    <i> </i> self.storage.setItem( "billing-zip", zip );
    <i> </i> self.storage.setItem( "billing-country", country );
    <i> </i> } else {
    <i> </i> var sName = $( "#sname", $set ).val();
    <i> </i> var sEmail = $( "#semail", $set ).val();
    <i> </i> var sCity = $( "#scity", $set ).val();
    <i> </i> var sAddress = $( "#saddress", $set ).val();
    <i> </i> var sZip = $( "#szip", $set ).val();
    <i> </i> var sCountry = $( "#scountry", $set ).val();
    <i> </i>
    <i> </i> self.storage.setItem( "shipping-name", sName );
    <i> </i> self.storage.setItem( "shipping-email", sEmail );
    <i> </i> self.storage.setItem( "shipping-city", sCity );
    <i> </i> self.storage.setItem( "shipping-address", sAddress );
    <i> </i> self.storage.setItem( "shipping-zip", sZip );
    <i> </i> self.storage.setItem( "shipping-country", sCountry );
    <i> </i>
    <i> </i> }
    <i> </i> });
    <i> </i> }
    <i> </i>};
    <i> </i>
    <i> </i>$(function() {
    <i> </i> var shop = new $.Shop( "#site" );
    <i> </i>});

    })( jQuery );


    if you need source code for all pages i can send but atm i think only index and cart.html for now.... for the options etc
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 18.2019 — what is best way do this options send in another page but not new tab but also add to a shopping cart that can add the js code above will not run in firefox as soon as i edit the code etc. not not all good at js.... i was thinking small but now im ready for who ever can help with code. that is easy to edit so if i need add a new item say it will = 3 all up n updates the cart i need something so i can sell my giftcards, postcards and enlarged photos etc.
    Copy linkTweet thisAlerts:
    @JMRKERDec 19.2019 — I don't know enough JQuery to be of any help with your posted code. If it makes sense to someone else, I will rely on them to make comments for improvement. My primary question would be if you loaded and have available the jquery code.

    I have a different approach that would work with the previous code I posted with the passing of command code to the second page you initially requested. I'll leave it to you to merge them together if you fell they would be of benefit

    <i>
    </i>&lt;!DOCTYPE html&gt;&lt;html lang="en"&gt;&lt;head&gt;&lt;title&gt; Test Page &lt;/title&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;meta name="viewport" content="width-device-width,initial-scale=1.0, user-scalable=yes"/&gt;
    &lt;style&gt;
    fieldset { width: 12em; }
    input[type="number"] { width: 4em; text-align: left; }
    &lt;/style&gt;
    &lt;/head&gt;&lt;body&gt;

    &lt;fieldset&gt; &lt;legend&gt; Photos &lt;/legend&gt;
    Quantity - Description &lt;br&gt;
    &lt;input type="number" name="photoquantity" value="0" data-item="8x10" data-cost="25"&gt; 8x10 $25
    &lt;br&gt;
    &lt;input type="number" name="photoquantity" value="0" data-item="5x7" data-cost="10"&gt; 5x7 $10
    &lt;br&gt;
    &lt;input type="number" name="photoquantity" value="0" data-item="Wallet" data-cost="15"&gt; 2x3 (12 wallet) $15
    &lt;/fieldset&gt;

    &lt;fieldset&gt; &lt;legend&gt; Giftcards &lt;/legend&gt;
    Quantity - Description &lt;br&gt;
    &lt;input type="number" name="giftcard" value="0" data-item="6x4" data-cost="4"&gt; 6x4 $4
    &lt;br&gt;
    &lt;input type="number" name="giftcard" value="0" data-item="5x7" data-cost="5"&gt; 5x7 $5
    &lt;/fieldset&gt;

    &lt;button id="calc"&gt; Submit &lt;/button&gt;
    &lt;script&gt;
    console.clear();

    function calcOrder() {
    var sum = 0, total = 0, orderInfo = [];
    var selPicks = document.getElementsByName('photoquantity'); <br/>
    var photoPicks = [...selPicks].filter(elem =&gt; elem.value != 0);
    for (let i=0; i&lt;photoPicks.length; i++) {
    sum = photoPicks[i].value * photoPicks[i].getAttribute('data-cost');
    if (sum != 0) { orderInfo.push(photoPicks[i].getAttribute('data-item')
    +':'+photoPicks[i].getAttribute('data-cost')
    +':'+photoPicks[i].value+':'+sum); }
    total += sum;
    }

    <i> </i> selPicks = document.getElementsByName('giftcard');
    var cardPicks = [...selPicks].filter(elem =&gt; elem.value != 0);
    for (let i=0; i&lt;cardPicks.length; i++) {
    sum = cardPicks[i].value * cardPicks[i].getAttribute('data-cost');
    if (sum != 0) { orderInfo.push(cardPicks[i].getAttribute('data-item')
    +':'+cardPicks[i].getAttribute('data-cost')
    +':'+cardPicks[i].value+':'+sum); }
    total += sum;
    }

    // alert(orderInfo.join('n')+'nTotal:'+total);
    orderInfo.push(total);
    info = JSON.stringify(orderInfo,null,2); alert(info); // for testing purposes
    // return JSON.stringify(orderInfo);
    }

    function init() {
    document.getElementById('calc').addEventListener( 'click', calcOrder )

    } init();
    &lt;/script&gt;

    &lt;/body&gt;&lt;/html&gt;

    I separated the drop down into checkboxes because I thought you might want to submit a quantity of each item and cost you allow the user to submit. You could return the JSON string in the command line string you send to the second page and decode the results there as needed. Keep in mind that order information is usually saved on a server using a database because it could supply additional checks of validity that this program does not supply.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 20.2019 — Thankyou JMRKER, I been trying to work out code you posted but couldn't quite get it some i did but when it comes to adding to it thats when i cant get it.... how do i fix this error i select number of photos etc or other it wont goto next page etc but when i click on 2nd pic pop up appears then it finally loads to next page but how could i improve that in a pro way? link to my website im trying hard to create with help in creating a shopping cart step by step im getting their slowly .


    https://shoppingcarttesting1.000webhostapp.com/

    step 1 is how to fix that error to move to the nxt stage?

    step 2 how could i add the selected items and add to a cart or not sure how even an auto update and a delete or goback to buy more giftcards, Postcards or photos what code will allow me to do it.

    could u create a step by step on how add to cart do u know of any good working youtube videos maybe video first and if i dont get it an example code that is easy to add later etc
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 20.2019 — and save cart so it wont lose itams someone has chosen
    Copy linkTweet thisAlerts:
    @JMRKERDec 21.2019 — I'm not sure how much knowledge you have of HTML and JS coding.


    Are you just a copy/paste programmer or do you have some understanding of the code posted.

    The reason I question this is that you might get your project up faster by hiring some professional help

    or taking more time to study the differences I will note here:.

  • - Why do you have a 'shop cart' link to page2.html before you make any selections?

  • - You have programmed 4 different pseudo-submit buttons when only one would be needed? It would make more sense to me to have your different images grouped into a selection gallery and have the script combine the selections for a one-time information submission.

  • - You have defined 4 different buttons as id="calc"? ID values must be unique to the page. Which one is to be chosen if you use a 'document.getElementById()' function?

  • - You have defined 2 different passval() functions that do not perform the same actions. Normally, only the last definition will be executed because names are overwritten in the order they appear.

  • - Are you looking at the error console when your programs don't work?

  • - Have you run the code through a HTML or JS validator link?

  • - The information from page1.html will be lost as soon as page2.html is called. I do not see anything in your page2.html that interacts with the shopping cart nor will it save the information passed. This is why I questioned your logic of needing two separate pages to create a selection display with information to be passed to a single database (at least to my understanding of your linked code).


  • I think it is OK to copy and paste so long as you understand the workings and

    interactions of the different scripts you are using or combining. The code I have

    provided was not intended to complete your project, only give you some tools to

    answer your posted questions and incorporate after you understand the code.

    As a suggestion, I would recommend you could, at least, answer each of the above

    points in your next post so that I could propose other, hopefully, more helpful scripts.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 22.2019 — the Shop page will be for images wtc once i get it to work ill change index page to home Photography page its just one of my mates at gym said to come here and keep asking until shopping cart can be made etc as i been trying for a long time n i just don't grip it so mate said don't stress out. its just when i look code up if it dont make make sense etc i wont get it.

    thankyou i will check those things and resend link to my website when i done it.... or tried

    so what your saying is basically is to get rid of passval() or which should i leave in?

    "calc" ID value id any photo i pick can goto say i shopping cart at this stage say page2.html as an example but be an option to got back to shop select another photo etc an so on at the end maybe a review page of items picked


    thankyou for your advice i will now over the next week try and fix what i can.. your are great help what you done so far...
    Copy linkTweet thisAlerts:
    @JMRKERDec 22.2019 — Look at the two functions:

    1st version
    <i>
    </i>function passval() {
    let info = document.getElementById('photoquantity').name;
    let uri = 'page2.html?info='+info;
    // let uri_enc = encodeURI(uri);
    // following opens existing site
    // var x = window.open(uri_enc,"","top=50,left=100,height=250,width=350");
    var x = window.open(uri,"page2.html"); // ,"top=50,left=100,height=250,width=350");
    }

    2nd version
    <i>
    </i>function passval() {
    &lt;!-- let info = document.getElementById('sbox').value; --&gt;
    let uri = 'page2.html?info='+info;
    let uri_enc = encodeURI(uri);
    // following opens existing site
    &lt;!-- var x = window.open(uri_enc,"page2.html","_self","top=50,left=100,height=250,width=350"); --&gt;
    var x = window.location.replace(uri,"page2.html"); // worked but not now..... ,"top=50,left=100,height=250,width=350");
    }

    If they were houses on the same street, which address (passval) would you go to?

    Answer: I don't know and neither does your computer.

    Another question:

    You collect information into a global variable called 'info' in both functions.

    I don't know what you are collecting in the first as there is no element ID 'photoquantity' to be retrieved by the getElementById and the 'name' attribute, if it could be found, does not contain any usable information.

    In the second, you use the 'info' value again with no guarantee that the calc() function was ever called to put information into the global variable. Same problem with your top line link to the shopping cart, when you pass information that has not be initialized to anything.

    Also:

    There is a difference in the call to page2.html that you should be aware of. One opens a new page and the other replaces the currently active page1.html. Potential problem here.

    Selections of additional images would not be possible in the second scenario. Also primary reason why I asked why the need for passing information to a second page2. If this is to be a real application in the future, I would strongly suggest that you look into saving the selections to a database as the JS code will not natively do this for you.

    I admire your tenacity to ask questions. But if you don't have the background to understand the responses given it is not the optimal learning method. Have you taken any JS or HTML courses in a class or online? It might be a better place to start than on this complex of a problem as your first project.

    Good Luck! :)
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 26.2019 — JMKER i havnt cant work it it out yet i fixed up some errors but now no error i dont know whats wrong js code but i will keep trying before i ask for server side etc.

    offline my images load up fine but when loaded into a free server the 2 middle images disappear kind of strange follow link below

    https://shoppingcarttesting1.000webhostapp.com/

    i dont see any errors that might be blocking my images i even destroy all my images and reloaded on a free server as it work fine offline i cant work out why the 2 images in middle are missing can anyone spot something i mas have missed?
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 26.2019 — ok all i fixed problem all i did was reload images 2x n then problem fixed problam with images so ill be working on your code later JMKER. do u know any server side lang... what should i be using to catch data price of any selected image? my m8 at gym said if you said js wont be good to catch data then learn something that will catch the data price of images etc what do u suggest JMKER? atm i rather not do something else until i that js code goes click i can say i can add ectra submit button by adding extra submit buttons whould that be an if else statement for submit buttons? etc i been doing a bit of reading into js but limited time at the moment....
    Copy linkTweet thisAlerts:
    @JMRKERDec 27.2019 — There is no function call here:

    var selPicks = document.getElementsById('photoquantity');


    because it is .getElementById, not .getElementsById

    and you do not have any element id=photoquantity.

    Also, you still have multiple functions called passval(). Will work, but not as desired by your project.

    and your jQuery code is still not defined. It is a framework that you are not accessing correctly.

    I would still suggest that you break your code into smaller parts. Then make sure each part works and that you understand what the part is doing and why. You seem to be creating more errors than you fix with each question.

    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 27.2019 — Thankyou JMRKER and happy new year.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorDec 29.2019 — JMRKER your first verison i get to work better 2nd version i cant work out yet so i sticking with first version i get to work etc.

    anyone how can i make a save, add, delete button and send it to paypal or square etc course code for this link https://testingwebsite999.000webhostapp.com/ i want to speed things up once this is fixed i can spend more time on other pages.... n hopefully get some sales nxt yr.
    Copy linkTweet thisAlerts:
    @gugaldasDec 29.2019 — Theory Men’s Double-breasted [Pea Coat](https://peacoat.org/theory-mens-double-breasted-pea-coat/)

    The outfit is unique and suits a host of outdoor functions.

    Concerning the maintenance of this graceful outfit, we can only recommend that it should be washed in cold water by machine using appropriate detergents. Otherwise, dry clean it.

    Kindly check our last “Size Chart” picture before ordering. If you are not sure which size fits you, please contact us without hesitation.
    Copy linkTweet thisAlerts:
    @Bigjohn7769authorJan 02.2020 — why you cunts not helping with nxt page fuck sack im not going anywhere im getting really pissed.

    no one bother to do any code that will link. other people get full code what there asking for if they ask but if i ask when i now i get fuck all i really want push forward but im going further back i found the version of code i want to use getting frustrated deleted other page maybe someone else know how to do above code. feels like im being ignored here....
    Copy linkTweet thisAlerts:
    @Steve_R_JonesmoderatorJan 02.2020 — {"locked":true}
    ×

    Success!

    Help @Bigjohn7769 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.25,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...