www.webdeveloper.com
Results 1 to 8 of 8

Thread: HTML Shop Code Edit (And Javascript)

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    19

    HTML Shop Code Edit (And Javascript)

    I have a shop code I'm using for my forum. It works great, but the only problem is that I can't seem to edit a few features to/from it.

    First, I'd like for the WHOLE quantity feature to be gone. I've tried removing anything that has itemqty or itemtotal but that broke the code :/

    Secondly, Spoilers don't seem to work when used with this code..

    Thirdly, and most important, I'd like to be able to add more than 1 table to this. I'm looking to add 3 more tables with the same layout of the build in one.

    Here is how I want it to look with the tables:
    http://i.imgur.com/DaIrttq.png


    Code:
    <div id='shopinfo' class='meta_box' style='display:none;text-align:center;'></div>
    <div class='category'><table class='cat_head'><tr><td><h2>Shop</h2></td></tr></table><table id='shoptable'>
    <tr><th style='width:1px;'></th><th>Item</th><th>Description</th><th>Price</th><th style='text-align:center;'>Qty</th><th ></th></tr>
    </table></div>
    
    <script type='text/javascript'>
    // Advanced Shop By Quozzo
    pointsname="Credits"
    pointsicon = ""
    var shopforum = "4034044";
    var shoptopic = "10119874";
    var shopitem = [
    //["img","Name","Description",Price,"additional info"]
    ["http://z5.ifrm.com/30294/18/0/f5261944/NameChange2.gif","Name Change","You are allowed 1 free name change, after that you must buy one here!",500,"Please tell us what you would like to change your name to!"],
    ["http://z5.ifrm.com/30294/18/0/f5262029/Gift-Orbs.gif","Gift Orbs","Did somebody help you? Do you want to make somebody's day? Gift them some Orbs here!",0,"Please tell us how many Orbs you would like to gift and who you would like to gift them to!"],
    ["http://z5.ifrm.com/30294/18/0/f5262087/Custom-Title.gif","Custom Title","Do you want to change your title? Well purchase one here!",125,"Please tell us what you would like your new title to be!"],
    ];
    var sendingtext = "<big><strong>Sending Purchase</strong></big>";
    var senttext = "<big><strong>Purchase Complete, Have a nice day</strong></big><br />It may take upto 24 hours for your transaction to be processed.";
    
    for(i=0;i<shopitem.length;i++){
    if(shopitem[i][0]){shopitem[i][0]="<img src='"+shopitem[i][0]+"'></img>"};
    $('#shoptable').append("<tr><td>"+shopitem[i][0]+"</td><td><strong>"+shopitem[i][1]+"</strong></td><td>"+shopitem[i][2]+"</td><td style='width:10%;'><span style='display:none;' class='singlecost'>"+shopitem[i][3]+"</span>"+pointsicon+"<span class='itemcost'>"+shopitem[i][3]+"</span></td><td style='text-align:center;width:10%'><a class='decrease' style='cursor:pointer;float:left;'>[-]</a> <a class='currentqty' style='cursor:pointer;'>1</a> <a class='increase' style='cursor:pointer;float:right;'>[+]</a></td><td style='width:10%;text-align:center;'><button class='purchase'>Purchase</button><span style='display:none'>"+shopitem[i][4]+"</span></td></tr>");
    };
    
    senttime=0
    $('.purchase').live('click',function(){
    $('#extrainfo').remove();
    conf=false;
    itemqty = $(this).parent().prev().find('.currentqty').text();
    itemprice = $(this).parent().prev().prev().find('.singlecost').text();
    totalprice = $(this).parent().prev().prev().find('.itemcost').text();
    itemdesc = $(this).parent().prev().prev().prev().text();
    itemname = $(this).parent().prev().prev().prev().prev().text();
    if(!$('#top_info:contains("Guest")').length){
    nowtime = Math.ceil((new Date().getTime())/1000);
    iteminfoneeded = $(this).next().text();
    if(nowtime-30<senttime){
    alert("Please wait a few seconds before purchasing something else");
    }else if(!iteminfoneeded){
    conf=confirm("Purchase "+itemqty+"x "+itemname+" for "+pointsicon+totalprice);
    }else{
    conf=true;
    }
    if(conf){
    if(!iteminfoneeded){
    sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname);
    }else if(!$(this).parent().parent().next().find('textarea').length){
    $(this).parent().parent().after("<tr id='extrainfo'><td colspan='5'>"+iteminfoneeded+"<br /><textarea rows='4'></textarea></td><td style='text-align:center;'><button id='confirm'>Confirm</button></td></tr>");
    };
    };
    };
    });
    
    function sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname,iteminfo,iteminfodesc){
    if(iteminfo){iteminfo="[hr]"+iteminfoneeded+": "+iteminfo}else{iteminfo=""}
    $('#shopinfo').show().html("<span>"+sendingtext+"</span>");
    purchased = "Item Name: "+itemname+"[hr]Description: "+itemdesc+"[hr]Price: "+pointsicon+itemprice+"[hr]Qty: "+itemqty+"[hr]Total Price: "+pointsicon+totalprice+iteminfo;
    $.get(main_url+"post/?mode=2&type=1&f="+shopforum+"&t="+shoptopic,function(d){
    $.post(main_url+"post/",{mode:2,type:1,f:shopforum,t:shoptopic,emo:1,ast:$("input[name=ast]",d).val(),xc:$("input[name=xc]",d).val(),post: purchased,q:0,qhash:$("input[name=qhash]",d).val(),sd:1,fcolor:'',helpbox:'Quote Text',zbpost:0,attach1:'',mod_opts:'',sig:1,post_submit:''});
    $('#shopinfo').html("<span>"+senttext+"</span>");
    senttime = Math.ceil((new Date().getTime())/1000);
    $('#extrainfo').remove();
    });
    };
    
    $('#confirm').live('click', function(){
    itemqty = $(this).parent().prev().find('.currentqty').text();
    itemprice = $(this).parent().parent().prev().find('.singlecost').text();
    totalprice = $(this).parent().parent().prev().find('.itemcost').text();
    itemdesc = $(this).parent().parent().prev().find('td:eq(2)').text();
    itemname = $(this).parent().parent().prev().find('td:eq(1)').text();
    iteminfo = $(this).parent().prev().find('textarea').val();
    iteminfodesc = $(this).parent().prev().text();
    sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname,iteminfo,iteminfodesc)
    });
    
    $('.increase').live('click',function(){
    thisqty = $(this).parent().find('.currentqty').text();
    plusqty = thisqty*1+1;
    $(this).parent().find('.currentqty').text(plusqty);
    singlecost = $(this).parent().prev().find('.singlecost').text();
    totalcost = singlecost*plusqty;
    $(this).parent().prev().find('.itemcost').text(totalcost);
    });
    
    $('.decrease').live('click',function(){
    thisqty = $(this).parent().find('.currentqty').text();
    if(thisqty<=1){alert("You cannot select an amount lower than 1");
    }else{
    minusqty = thisqty*1-1;
    $(this).parent().find('.currentqty').text(minusqty);
    singlecost = $(this).parent().prev().find('.singlecost').text();
    totalcost = singlecost*minusqty;
    $(this).parent().prev().find('.itemcost').text(totalcost);
    };
    });
    
    $('.currentqty').live('click',function(){
    currentqty = $(this).html();
    $(this).replaceWith("<input class='setqty' size='2'/>");
    $('.setqty').focus();
    });
    
    $(".setqty").live('focusout', function() {
    $(this).replaceWith("<a class='currentqty' style='cursor:pointer;'>"+currentqty+"</a>");
    });
    
    $('.setqty').live('keypress', function(e) {
    if(e.keyCode==13){
    setqty = $('.setqty').val();
    if(!setqty){setqty=currentqty};
    if(isNaN(setqty)){setqty=currentqty};
    if(setqty<1){setqty=currentqty};
    singlecost = $(this).parent().prev().find('.singlecost').text();
    totalcost = singlecost*setqty;
    $(this).parent().prev().find('.itemcost').text(totalcost);
    $(this).replaceWith("<a class='currentqty' style='cursor:pointer;'>"+setqty+"</a>");
    };
    });
    </script>

    Here is the spoiler I'm trying to use with this code, It shows the spoiler but doesn't react when I click show/hide
    Code:
    <div class="category">
    <table class="cat_head">
    <tr><td><h2>View Requirements</h2></td></tr></table>
    <div class="spoiler">
    <button type="button" onclick="showSpoiler(this);" value="Submit">Show/Hide Rules</button>
    <div class="inner" style="display:none;">
    <table><font face="Verdana, Verdana" size="2" color="#717171">
    <tr><td><p>  <font color="#ff0000"><b>Some text here</b></font></p></td></tr>
    </table>
    </div></div></div>

  2. #2
    Join Date
    Feb 2014
    Posts
    19
    Update: I got multiple tables working.
    I still need to know why Spoilers don't work and take Quantity out if possible.

  3. #3
    Join Date
    Feb 2014
    Posts
    19
    Nobody?

  4. #4
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    862
    Sorry, Kankuro, but these kinds of questions are difficult to answer given how specific they are to your forum and all of its code/mods/plugins. Often times it's not a matter of pasting a few parts of your code up and having a solution be found because the problem could lie elsewhere and we have no way of seeing/testing that.

    Now, moving on, to help with your quantity issue, you probably can't pull the quantity feature out entirely (at least not with just the code provided. It seems to submit to another file (in the sendpurchase function) which will likely be looking for specific parameters, such as a quantity. However, you can simply hide this on the front-end and leave it at the default of 1. For simplicity I'll just paste all of the code you gave, but with updates to the quantity:
    Code:
    <div id='shopinfo' class='meta_box' style='display:none;text-align:center;'></div>
    <div class='category'><table class='cat_head'><tr><td><h2>Shop</h2></td></tr></table><table id='shoptable'>
    <tr><th style='width:1px;'></th><th>Item</th><th>Description</th><th>Price</th><th></th></tr>
    </table></div>
    
    <script type='text/javascript'>
    	// Advanced Shop By Quozzo
    	pointsname="Credits"
    	pointsicon = ""
    	var shopforum = "4034044";
    	var shoptopic = "10119874";
    	var shopitem = [
    	//["img","Name","Description",Price,"additional info"]
    	["http://z5.ifrm.com/30294/18/0/f5261944/NameChange2.gif","Name Change","You are allowed 1 free name change, after that you must buy one here!",500,"Please tell us what you would like to change your name to!"],
    	["http://z5.ifrm.com/30294/18/0/f5262029/Gift-Orbs.gif","Gift Orbs","Did somebody help you? Do you want to make somebody's day? Gift them some Orbs here!",0,"Please tell us how many Orbs you would like to gift and who you would like to gift them to!"],
    	["http://z5.ifrm.com/30294/18/0/f5262087/Custom-Title.gif","Custom Title","Do you want to change your title? Well purchase one here!",125,"Please tell us what you would like your new title to be!"],
    	];
    	var sendingtext = "<big><strong>Sending Purchase</strong></big>";
    	var senttext = "<big><strong>Purchase Complete, Have a nice day</strong></big><br />It may take upto 24 hours for your transaction to be processed.";
    
    	for(i=0;i<shopitem.length;i++) {
    		if(shopitem[i][0]) shopitem[i][0] = "<img src='"+shopitem[i][0]+"'></img>";
    		
    		$('#shoptable').append("<tr><td>"+shopitem[i][0]+"</td><td><strong>"+shopitem[i][1]+"</strong></td><td>"+shopitem[i][2]+"</td><td style='width:10%;'><span style='display:none;' class='singlecost'>"+shopitem[i][3]+"</span>"+pointsicon+"<span class='itemcost'>"+shopitem[i][3]+"</span></td><td style='width:10%;text-align:center;'><button class='purchase'>Purchase</button><span style='display:none'>"+shopitem[i][4]+"</span></td></tr>");
    	}
    
    	senttime = 0;
    	$('.purchase').live('click',function() {
    		$('#extrainfo').remove();
    		conf = false;
    		itemqty = "1";
    		itemprice = $(this).parent().prev().prev().find('.singlecost').text();
    		totalprice = $(this).parent().prev().prev().find('.itemcost').text();
    		itemdesc = $(this).parent().prev().prev().prev().text();
    		itemname = $(this).parent().prev().prev().prev().prev().text();
    		if(!$('#top_info:contains("Guest")').length){
    			nowtime = Math.ceil((new Date().getTime())/1000);
    			iteminfoneeded = $(this).next().text();
    			if(nowtime-30 < senttime) {
    				alert("Please wait a few seconds before purchasing something else");
    			} else if(!iteminfoneeded) {
    				conf = confirm("Purchase "+itemname+" for "+pointsicon+totalprice);
    			} else {
    				conf = true;
    			}
    			if(conf) {
    				if(!iteminfoneeded) {
    					sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname);
    				} else if(!$(this).parent().parent().next().find('textarea').length) {
    					$(this).parent().parent().after("<tr id='extrainfo'><td colspan='5'>"+iteminfoneeded+"<br /><textarea rows='4'></textarea></td><td style='text-align:center;'><button id='confirm'>Confirm</button></td></tr>");
    				}
    			}
    		}
    	});
    
    	function sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname,iteminfo,iteminfodesc) {
    		if(iteminfo) { iteminfo = "[hr]"+iteminfoneeded+": "+iteminfo; } else { iteminfo = ""; }
    		$('#shopinfo').show().html("<span>"+sendingtext+"</span>");
    		purchased = "Item Name: "+itemname+"[hr]Description: "+itemdesc+"[hr]Price: "+pointsicon+itemprice+"[hr]Total Price: "+pointsicon+totalprice+iteminfo;
    		$.get(main_url+"post/?mode=2&type=1&f="+shopforum+"&t="+shoptopic,function(d){
    			$.post(main_url+"post/",{mode:2,type:1,f:shopforum,t:shoptopic,emo:1,ast:$("input[name=ast]",d).val(),xc:$("input[name=xc]",d).val(),post: purchased,q:0,qhash:$("input[name=qhash]",d).val(),sd:1,fcolor:'',helpbox:'Quote Text',zbpost:0,attach1:'',mod_opts:'',sig:1,post_submit:''});
    			$('#shopinfo').html("<span>"+senttext+"</span>");
    			senttime = Math.ceil((new Date().getTime())/1000);
    			$('#extrainfo').remove();
    		});
    	}
    
    	$('#confirm').live('click', function() {
    		itemqty = "1";
    		itemprice = $(this).parent().parent().prev().find('.singlecost').text();
    		totalprice = $(this).parent().parent().prev().find('.itemcost').text();
    		itemdesc = $(this).parent().parent().prev().find('td:eq(2)').text();
    		itemname = $(this).parent().parent().prev().find('td:eq(1)').text();
    		iteminfo = $(this).parent().prev().find('textarea').val();
    		iteminfodesc = $(this).parent().prev().text();
    		sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname,iteminfo,iteminfodesc);
    	});
    </script>
    For the record, I also ripped out the quantity related functions as they didn't seem needed. However in the event something goes wrong (relating to the quantity) you can always throw them back in.

    Now for your spoilers... You seem to be calling a function called showSpoiler() which isn't posted. It may or may not be responsible but it is definitely related and this is where I reiterate the idea that these types of questions are difficult to answer due to the specificity of each case such as your own. The first thing I would start doing to solve your issue would be hit F12 and check out the console tab to see what's going on when you click to hide/show a spoiler. If you are getting errors, this is good because you'll now be given a line number and file to look into and fix/update. If you aren't seeing any errors when clicking the button then you'll have to find out why nothing seems to trigger. You can also add 'console.log()' lines inside of the showSpoiler() function to see what is happening as the function is running. Throw some variables inside of the console.log() function to see how they change throughout the function, or just put in "Hello World!" to see how far your function goes and if each part of the function successfully triggers or where it stops.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  5. #5
    Join Date
    Feb 2014
    Posts
    19
    Quote Originally Posted by Sup3rkirby View Post
    Sorry, Kankuro, but these kinds of questions are difficult to answer given how specific they are to your forum and all of its code/mods/plugins. Often times it's not a matter of pasting a few parts of your code up and having a solution be found because the problem could lie elsewhere and we have no way of seeing/testing that.

    Now, moving on, to help with your quantity issue, you probably can't pull the quantity feature out entirely (at least not with just the code provided. It seems to submit to another file (in the sendpurchase function) which will likely be looking for specific parameters, such as a quantity. However, you can simply hide this on the front-end and leave it at the default of 1. For simplicity I'll just paste all of the code you gave, but with updates to the quantity:
    Code:
    <div id='shopinfo' class='meta_box' style='display:none;text-align:center;'></div>
    <div class='category'><table class='cat_head'><tr><td><h2>Shop</h2></td></tr></table><table id='shoptable'>
    <tr><th style='width:1px;'></th><th>Item</th><th>Description</th><th>Price</th><th></th></tr>
    </table></div>
    
    <script type='text/javascript'>
    	// Advanced Shop By Quozzo
    	pointsname="Credits"
    	pointsicon = ""
    	var shopforum = "4034044";
    	var shoptopic = "10119874";
    	var shopitem = [
    	//["img","Name","Description",Price,"additional info"]
    	["http://z5.ifrm.com/30294/18/0/f5261944/NameChange2.gif","Name Change","You are allowed 1 free name change, after that you must buy one here!",500,"Please tell us what you would like to change your name to!"],
    	["http://z5.ifrm.com/30294/18/0/f5262029/Gift-Orbs.gif","Gift Orbs","Did somebody help you? Do you want to make somebody's day? Gift them some Orbs here!",0,"Please tell us how many Orbs you would like to gift and who you would like to gift them to!"],
    	["http://z5.ifrm.com/30294/18/0/f5262087/Custom-Title.gif","Custom Title","Do you want to change your title? Well purchase one here!",125,"Please tell us what you would like your new title to be!"],
    	];
    	var sendingtext = "<big><strong>Sending Purchase</strong></big>";
    	var senttext = "<big><strong>Purchase Complete, Have a nice day</strong></big><br />It may take upto 24 hours for your transaction to be processed.";
    
    	for(i=0;i<shopitem.length;i++) {
    		if(shopitem[i][0]) shopitem[i][0] = "<img src='"+shopitem[i][0]+"'></img>";
    		
    		$('#shoptable').append("<tr><td>"+shopitem[i][0]+"</td><td><strong>"+shopitem[i][1]+"</strong></td><td>"+shopitem[i][2]+"</td><td style='width:10%;'><span style='display:none;' class='singlecost'>"+shopitem[i][3]+"</span>"+pointsicon+"<span class='itemcost'>"+shopitem[i][3]+"</span></td><td style='width:10%;text-align:center;'><button class='purchase'>Purchase</button><span style='display:none'>"+shopitem[i][4]+"</span></td></tr>");
    	}
    
    	senttime = 0;
    	$('.purchase').live('click',function() {
    		$('#extrainfo').remove();
    		conf = false;
    		itemqty = "1";
    		itemprice = $(this).parent().prev().prev().find('.singlecost').text();
    		totalprice = $(this).parent().prev().prev().find('.itemcost').text();
    		itemdesc = $(this).parent().prev().prev().prev().text();
    		itemname = $(this).parent().prev().prev().prev().prev().text();
    		if(!$('#top_info:contains("Guest")').length){
    			nowtime = Math.ceil((new Date().getTime())/1000);
    			iteminfoneeded = $(this).next().text();
    			if(nowtime-30 < senttime) {
    				alert("Please wait a few seconds before purchasing something else");
    			} else if(!iteminfoneeded) {
    				conf = confirm("Purchase "+itemname+" for "+pointsicon+totalprice);
    			} else {
    				conf = true;
    			}
    			if(conf) {
    				if(!iteminfoneeded) {
    					sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname);
    				} else if(!$(this).parent().parent().next().find('textarea').length) {
    					$(this).parent().parent().after("<tr id='extrainfo'><td colspan='5'>"+iteminfoneeded+"<br /><textarea rows='4'></textarea></td><td style='text-align:center;'><button id='confirm'>Confirm</button></td></tr>");
    				}
    			}
    		}
    	});
    
    	function sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname,iteminfo,iteminfodesc) {
    		if(iteminfo) { iteminfo = "[hr]"+iteminfoneeded+": "+iteminfo; } else { iteminfo = ""; }
    		$('#shopinfo').show().html("<span>"+sendingtext+"</span>");
    		purchased = "Item Name: "+itemname+"[hr]Description: "+itemdesc+"[hr]Price: "+pointsicon+itemprice+"[hr]Total Price: "+pointsicon+totalprice+iteminfo;
    		$.get(main_url+"post/?mode=2&type=1&f="+shopforum+"&t="+shoptopic,function(d){
    			$.post(main_url+"post/",{mode:2,type:1,f:shopforum,t:shoptopic,emo:1,ast:$("input[name=ast]",d).val(),xc:$("input[name=xc]",d).val(),post: purchased,q:0,qhash:$("input[name=qhash]",d).val(),sd:1,fcolor:'',helpbox:'Quote Text',zbpost:0,attach1:'',mod_opts:'',sig:1,post_submit:''});
    			$('#shopinfo').html("<span>"+senttext+"</span>");
    			senttime = Math.ceil((new Date().getTime())/1000);
    			$('#extrainfo').remove();
    		});
    	}
    
    	$('#confirm').live('click', function() {
    		itemqty = "1";
    		itemprice = $(this).parent().parent().prev().find('.singlecost').text();
    		totalprice = $(this).parent().parent().prev().find('.itemcost').text();
    		itemdesc = $(this).parent().parent().prev().find('td:eq(2)').text();
    		itemname = $(this).parent().parent().prev().find('td:eq(1)').text();
    		iteminfo = $(this).parent().prev().find('textarea').val();
    		iteminfodesc = $(this).parent().prev().text();
    		sendpurchase(itemqty,itemprice,totalprice,itemdesc,itemname,iteminfo,iteminfodesc);
    	});
    </script>
    For the record, I also ripped out the quantity related functions as they didn't seem needed. However in the event something goes wrong (relating to the quantity) you can always throw them back in.

    Now for your spoilers... You seem to be calling a function called showSpoiler() which isn't posted. It may or may not be responsible but it is definitely related and this is where I reiterate the idea that these types of questions are difficult to answer due to the specificity of each case such as your own. The first thing I would start doing to solve your issue would be hit F12 and check out the console tab to see what's going on when you click to hide/show a spoiler. If you are getting errors, this is good because you'll now be given a line number and file to look into and fix/update. If you aren't seeing any errors when clicking the button then you'll have to find out why nothing seems to trigger. You can also add 'console.log()' lines inside of the showSpoiler() function to see what is happening as the function is running. Throw some variables inside of the console.log() function to see how they change throughout the function, or just put in "Hello World!" to see how far your function goes and if each part of the function successfully triggers or where it stops.
    Well my code has greatly increased so I dont' want to mess with too much so I'm just going to leave QTY in there.

    As for spoilers, the console says that "showSpoiler is not defined" which is off because the EXACT same spoiler code works on other webpages I have it added to like this one

  6. #6
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    862
    You could always post any updated code in regards to the quantity issue, but unless the actual code you pasted in your original post has changed you should still be able to swap it out for mine. All I did was make it so that the table column with 'Qty' no longer shows up on the page. And because of that 'purchasing' any item just sends it with a default quantity of 1, rather than checking the quantity set by the user.

    In any case, moving on to the spoiler problem. There are actually a number of reasons you might see "x_function is not defined", but I'll assume all other functions/scripts are working properly on the page which means it isn't a syntax error (for reference, a syntax error anywhere in your js can cause all functions to appear to be not defined as the browser failed to parse your js). You say the same function works on other webpages like that one, but that doesn't mean it's defined on every page. It's likely that the function is in a block of code that is only included on pages where it was originally designed to work. My guess is you'll have to manually copy that function and include it on the page.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

  7. #7
    Join Date
    Feb 2014
    Posts
    19
    Quote Originally Posted by Sup3rkirby View Post
    You could always post any updated code in regards to the quantity issue, but unless the actual code you pasted in your original post has changed you should still be able to swap it out for mine. All I did was make it so that the table column with 'Qty' no longer shows up on the page. And because of that 'purchasing' any item just sends it with a default quantity of 1, rather than checking the quantity set by the user.

    In any case, moving on to the spoiler problem. There are actually a number of reasons you might see "x_function is not defined", but I'll assume all other functions/scripts are working properly on the page which means it isn't a syntax error (for reference, a syntax error anywhere in your js can cause all functions to appear to be not defined as the browser failed to parse your js). You say the same function works on other webpages like that one, but that doesn't mean it's defined on every page. It's likely that the function is in a block of code that is only included on pages where it was originally designed to work. My guess is you'll have to manually copy that function and include it on the page.
    I've copied an EXACT copy of a working spoiler code and it still didn't work.

  8. #8
    Join Date
    Mar 2005
    Location
    Behind you...
    Posts
    862
    Quote Originally Posted by Kankuro View Post
    I've copied an EXACT copy of a working spoiler code and it still didn't work.
    When you say 'copy of a working spoiler code' what are you referring to? Are you talking about just something like this from your original post:
    Code:
    <div class="category">
    <table class="cat_head">
    <tr><td><h2>View Requirements</h2></td></tr></table>
    <div class="spoiler">
    <button type="button" onclick="showSpoiler(this);" value="Submit">Show/Hide Rules</button>
    <div class="inner" style="display:none;">
    <table><font face="Verdana, Verdana" size="2" color="#717171">
    <tr><td><p> • <font color="#ff0000"><b>Some text here</b></font></p></td></tr>
    </table>
    </div></div></div>
    If that's all then you would still be missing the function to show and hide the spoiler itself. There should be a bit of javascript somewhere that starts out like
    Code:
    function showSpoiler(element) {
      // Spoiler magic happens here
      ...
    }
    That's the essential part that I feel you are likely missing. However, if you're already including it as well as the spoiler html as well then I guess I'd need more info from troubleshooting/debugging in the console.
    "Given billions of tries, could a spilled bottle of ink ever fall into the words of Shakespeare?"

Thread Information

Users Browsing this Thread

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

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



Recent Articles