There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell display driver drivers email error excel explorer firefox firefox 3 hard drive internet internet explorer itunes laptop lcd linux malware monitor network networking outlook outlook 2003 outlook express password printer problem ram router security slow software sound sprtcmd.exe trojan usb virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: including javascript into html


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Shelbyville's Avatar
Junior Member with 17 posts.
 
Join Date: Oct 2007
Experience: Beginner
02-Oct-2007, 07:24 AM #1
Smile Solved: including javascript into html
Hi,

I am trying to create a function inside a web page that allows a user to input their postcode and provided the postcode begins with "G", an alert message would appear saying "We do deliver to your area" otherwise the message would read "Unfortunately at the moment we are unable to deliver in your area". This is what i've done so far, but i'm a bit lost..........

HTML Code:
<table><tr><td><div style="position:relative; left:20px"><br />
    Postcode:&nbsp;&nbsp; <input name="postcode" type="text" maxlength="12" id="postcodeid" class="Workflow" style="width:90px;" /><INPUT type="text" style="VISIBILITY: hidden;POSITION: absolute"><input type="button" name=""b1" value="Enter";
<script type="text/javascript"><script><--!                
                                      
                                      if ("postcode" == "G*") {
                                                    alert ("We do deliver to you area")
                                     }
                                     else {
                                                    alert("Unfortunately we are unable to deliver to you area at the moment")
                                     }
--></script> </div> </td></tr></table>
Any help to point out where i'm going wrong would be greatly appreciated
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,250 posts.
 
Join Date: Oct 2006
02-Oct-2007, 02:13 PM #2
HTML Code:
<table><tr><td><div style="position:relative; left:20px"><br /> 
Postcode:&nbsp;&nbsp; <input name="postcode" type="text" maxlength="12" id="postcodeid" class="Workflow" style="width:90px;" onclick="checkarea(this.value);" /><input type="text" style="VISIBILITY: hidden; POSITION: absolute" /> <input type="button" name="b1" value="Enter" /> <script type="text/javascript"> <!--
function checkarea(value)
{
if (value.match(/g/))
	alert ("We do deliver to you area");
else
	alert("Unfortunately we are unable to deliver to you area at the moment");
}
//--> </script> </div></td></tr></table>
__________________
Guys, please, this is free tech support, act accordingly.
namenotfound's Avatar
Computer Specs
Distinguished Member with 2,197 posts.
 
Join Date: Apr 2005
Location: New York
Experience: I know what I know, I am
02-Oct-2007, 03:43 PM #3
since when do postcodes have letters?
All the postcodes I've seen have been 5-digit numbers; sometimes 4 extra digits at the end if its a business post.
like 12345-1234 or just 12345
Shelbyville's Avatar
Junior Member with 17 posts.
 
Join Date: Oct 2007
Experience: Beginner
03-Oct-2007, 05:00 AM #4
Thanks for you help
Anthony:-P's Avatar
Computer Specs
Senior Member with 449 posts.
 
Join Date: Nov 2006
Location: UK
Experience: Between Intermediate and
03-Oct-2007, 05:35 AM #5
Quote:
Originally Posted by namenotfound
since when do postcodes have letters?
All the postcodes I've seen have been 5-digit numbers; sometimes 4 extra digits at the end if its a business post.
like 12345-1234 or just 12345
UK ones have letters
I.e TR7 2TD

stands for something...first two letters, the city/town/sorting depot the mail goes too, in this case "truro"

the other stuff i don't really know, never bothered to research it although i might now.

Regards,
Anthony
MMJ's Avatar
MMJ MMJ is offline
Distinguished Member with 3,250 posts.
 
Join Date: Oct 2006
03-Oct-2007, 01:19 PM #6
Quote:
Originally Posted by Shelbyville
Thanks for you help
No problem.
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:28 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.