Current location: Hot Scripts Forums » General Web Coding » JavaScript » Question about Objects


Question about Objects

Reply
  #1 (permalink)  
Old 05-31-06, 12:45 AM
funknl funknl is offline
New Member
 
Join Date: Apr 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Unhappy Question about Objects

I am currently making a shopping cart, yet im having some troubles on my products page showing the proudct.

I want users to be able to see how much its going to cost when they input there quality they would like to get.

Using Javascript the onkeyup able to get what the person has inputted, yet i am having some troubles passing it.

Quote:
<script type="text/javascript">
function writeMessage<? $c = $c;$c=$c+1; echo $c; ?>() {
document.cart_quantity.quality<? echo $c; ?>.value=cart_quantity.Qty_ProdId_<?php echo '[' . $products_options['products_options_values_id'] . ']'; ?>.value;
}
</script>
It comes up as an error, the reason for the $c is that it is in a loop.

The error reads:

'cart_quality.Qty_ProdId_.1' is null or not an object

Im using

Qty_ProdID_[$i] in PHP to pick up the different product ids and is the name of the input box were users input the quality.'

Hope you can help me and that you understand my query.

Thank you.
Reply With Quote
  #2 (permalink)  
Old 05-31-06, 10:05 AM
TwoD TwoD is offline
Community VIP
 
Join Date: Sep 2003
Location: 404
Posts: 1,813
Thanks: 0
Thanked 0 Times in 0 Posts
There is a dot between ProdID_ and 1. JS thinks you want to access the object "1" in "document.Qty_ProdId_", which doesn't exist.
The end result should be "cart_quality.Qty_ProdId_1.value".
__________________
[W3Schools - learn all about the standards.] [QuirksMode - Browser Quirks] [MS's Online Reference Docs] [DOM in Gecko.]
Please pay attention to stickys, announcements and forum rules, thank you.
Please also remember Code Wrappers and [SOLVED] Marking, this helps everyone.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Objects and Storing Multiple Serialized Objects Into a Text File digioz PHP 6 08-23-05 01:43 PM
Posting a question / answer on site markcody PHP 2 11-23-04 01:58 PM
[PHP] Array question UmiSal Script Requests 1 04-05-04 01:52 PM
question and answer software jaydifox C/C++ 0 02-21-04 09:26 AM
objects of objects Skeleton Man PHP 2 01-02-04 03:06 AM


All times are GMT -5. The time now is 11:10 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.