SunQuest
           Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Try It Free
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 28th, 2004, 05:58 PM
splashedwater splashedwater is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medford, Oregon, USA
Posts: 6 splashedwater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to splashedwater
help with client side refresh javascript

Hi guys,

I have a form set up using PHP, MYSQL, and HTML. Basically I am using radio buttons to give the user options of what product to select, then depending on the product they want to purchase I'm displaying my price at the bottom of the page, fairly simple. I am new to java but have heard that you can preload everything and make it user side to make refresh times almost non-existent. Up to now I have been unsuccessfull finding any sort of guides, sample codes, or similar topics on forums. If anyone has any advice, links, or knows of any books that tackle this problem please help. I basically just need some direction. Thanks.

Reply With Quote
  #2  
Old October 29th, 2004, 10:14 AM
Yian Yian is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 279 Yian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: help with client side refresh javascript

Btw, its Javascript not Java, Java is an entirely different language.

Well I suppose you could just use an array in the Javascript that contains the relevant prices. Then using document.pricetextboxname.value = prices(num)

But this will be better if you can use a server side language to put into the javascript array only the prices needed for the category that the user is in.

Reply With Quote
  #3  
Old October 29th, 2004, 05:59 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: help with client side refresh javascript

Yea, sorry, I meant javascript. I need a little more then that, are there in books out that talk about this, or any tutorials on the web that I'm missing. Thanks.

Reply With Quote
  #4  
Old October 29th, 2004, 06:01 PM
splashedwater splashedwater is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medford, Oregon, USA
Posts: 6 splashedwater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to splashedwater
RE: help with client side refresh javascript

Sorry I didn't mean to post anonymously, that last post was me though.

Reply With Quote
  #5  
Old October 31st, 2004, 11:16 AM
Yian Yian is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: UK
Posts: 279 Yian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: help with client side refresh javascript

I assume you are getting all the info of the products from the database and storing it in an multi array .ie. $array[item_id][item_info]
Therefore you can have a Javascript thing at the top of your page that the php can insert the prices into:
<script>
<?php
echo "prices = new array(";
for($i=0;$i<count($item_array);$i++){
echo $item_array[$i]["price"].","
}
echo ")n";
?>
function add(id){
document.pricetextbox.value = document.pricetextbox.value + prices[id]
}
</script>

Then your data:

<?php
for($i=0;$i<count($item_array);$i++){
echo $item_array[$i]["info"];
echo $item_array[$i]["price"];
echo "<input type="button" onClick="add(".$i.")" value="Add this item">n";
}

echo "<br>n";
echo "<form method="post" action="buypage">n";
echo "Total: £<input type="text" name="pricetextbox" value="00.00">n";
echo "<input type="submit" name="submit" = value=" Submit ">n";
echo "</form>n";
?>

Reply With Quote
  #6  
Old November 1st, 2004, 12:04 AM
splashedwater splashedwater is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Medford, Oregon, USA
Posts: 6 splashedwater User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to splashedwater
RE: help with client side refresh javascript

Thanks guys! Works beautifully!

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > help with client side refresh javascript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Try It Free




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway