Buy Sell Discuss UK Domain Names at AcornDomains.co.uk Price Freeze on Business Hosting frm £4.95/month

Today's Drop Dates are: 19-02-2012 or 26-02-2012   All times are GMT. The time now is 12:40:01 PM.
Domain Name Sales Domain Software Calculate UK Domain Drop Dates Domain Registration NameDrive Domain Parking Subscribe to our Domains For Sale newsletter
Go Back   Domain Forum Acorn Domains Buy Sell Auction UK Domains > Website Design and Promotion > Website Design > Scripts and Coding
Connect with Facebook

Scripts and Coding PHP, MySQL, scripts

Closed Thread
 
LinkBack Thread Tools Display Modes
Old 22-06-2010, 03:16:28 PM     #1 (permalink)

 
techtimmy's Avatar
 
Join Date: Mar 2008
Posts: 328
techtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond repute

simple javascript nightmare

Hopefully really easy for someone with even a basic understanding of javascript.

I've 'written' a function which collects the info from a form field:

Quote:
var justhow;
function calculate(select)
{
justhow = document.forms[0].howmany.value;
}
When i try to call the bugger later on

Quote:
document.write('<input type="text" name="total" size="10" value="' + justhow + '">');
it comes back as undefined.


I know it works fine as if I move the document.write into the function it does the calculation (but in a new page?!?!?)

I thinkits something to do with global/local variables but after reading about 50 different tutorials its still not working.

Can anyone help?

Thanks
__________________
Does your business need a boost? Reach out to new customers with email marketing from Boost My Business
techtimmy is offline  
Old 23-06-2010, 01:38:32 AM     #2 (permalink)

 
Join Date: Jan 2007
Location: Barnsley, South Yorkshire
Posts: 523
StudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond repute

Hi

This should help:
Quote:
var justhow;
function calculate(){
justhow = document.getElementById('howmany').value;
document.getElementById('total').value = justhow;
}
Then in your page you would need the following form fields:
Quote:
<input type="text" id="howmany" size="10" value="" onkeyup="javascript:calculate(this.value)">
<input type="text" id="total" size="10" value="">
Whenever the value of field id "howmany" is changed, the value of field id "total" will be updated.

Hope this helps!

Craig
StudioVision is offline  
Old 23-06-2010, 09:35:49 AM     #3 (permalink)

 
techtimmy's Avatar
 
Join Date: Mar 2008
Posts: 328
techtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond reputetechtimmy has a reputation beyond repute

Awesome skillz dude.

Many many thanks
techtimmy is offline  
Old 23-06-2010, 04:37:54 PM     #4 (permalink)

 
Join Date: Jan 2007
Location: Barnsley, South Yorkshire
Posts: 523
StudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond reputeStudioVision has a reputation beyond repute

No worries, glad it helped!
StudioVision is offline  
Closed Thread



Bookmarks

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Domain Name Community Replies Last Post
Your Simple Yet Very Effective Guide in Starting Your Own Website - Identity Loop RSS Domain Name News 0 01-06-2010 12:59:01 PM
Nightmare week golddiggerguy General Board 10 24-01-2009 06:47:42 PM
Simple contact form fermes Website Design 5 14-10-2008 12:34:51 PM
A new simply way to make a image slider- Javascript Code o0DarkEvil0o Website Design 0 17-05-2008 07:05:15 AM
Simple Javascript help aquanuke Website Design 2 18-10-2007 03:00:03 PM


All times are GMT. The time now is 12:40:01 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.6.0 RC 2
All content on Acorn Domains is member generated and is not moderated before posting. All content is viewed and used by you at your own risk and AD does not warrant the accuracy or reliability of any of the information. The views expressed are those of the individual contributors and not necessarily those of AD. Please contact us to report any issues or send a PM to "Admin".