Computer ForumsComputers  

Go Back   Computer Forums > Programmers Lounge > Programming Discussions

Reply
 
LinkBack Thread Tools Display Modes
Old 05-14-2007, 05:43 AM   #1 (permalink)
Newb Techie
 
Join Date: May 2007
Posts: 2
Default quick javascript help

I have a field called field@code1 in a form in a XSL page.

i want to use java script to do validation.

the javascript errors if there is a @ in it.

1. is there any way of putitng an @ in javascript
2. is there any other way i can referance the field.

thanks
joe33 is offline   Reply With Quote
Old 05-15-2007, 03:29 PM   #2 (permalink)
Monster Techie
 
Join Date: May 2004
Location: Tucson, AZ, USA
Posts: 1,184
Send a message via AIM to Vormund Send a message via MSN to Vormund Send a message via Yahoo to Vormund
Default Re: quick javascript help

Using the getElementById it can be done easily, one example below:

HTML Code:
<html> <head> <script type="text/javascript">
      function referenceMe( fieldID )
      {
        var field = document.getElementById( fieldID );
        alert( "The value of the field " + fieldID + " is: " + field.value );
      }
    </script> </head> <body> <input type="text" id="test@code" onkeyup="javascript:referenceMe( this.id )"> </body> </html>
Or if you wanted to pass the field id in the function itself, you'd just surround it with single quotes, eg:
onkeyup="javascript:referenceMe( 'test@code' )"

Sorry, this wasn't all too quick.
__________________

Last edited by Vormund; 05-15-2007 at 03:31 PM.
Vormund is offline   Reply With Quote
Reply

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NEED help with a Javascript code...(mouseover and stuff) Quintox Web Graphics, design, digital images 7 05-02-2007 05:41 PM
Quick question sailpog Building, Buying, or Upgrading High Performance PC Systems 4 04-11-2007 10:38 PM
JavaScript Botnet Code Leaked To Internet Osiris Virus - Spyware Protection / Detection 0 04-02-2007 08:05 PM
quick question Fozzy Building, Buying, or Upgrading High Performance PC Systems 2 03-25-2007 08:46 AM


All times are GMT -5. The time now is 01:21 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0