473,387 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ID undefined

i am currently designing a form and am having trouble with a piece of java when i put it in the document...

The following works fine by itself, and even when i put it in other documents, however when i place it in the document i need and FireBug it, it says that the id "yesno" is not defined... Any ideas?

Expand|Select|Wrap|Line Numbers
  1. <style>
  2. /* Normal style */
  3.      .normal {
  4.       font-family: Comic Sans MS, sans-serif; 
  5.      }
  6.  
  7.     /* Display block */
  8.      .DisplayBlock {
  9.       display : block;
  10.     }
  11.     /* Display none */
  12.      .DisplayNone {
  13.       display: none;
  14.      }
  15.  
  16. </style>
  17. <script language="javascript">
  18. function classChange(element,newclass) {
  19.     element.className = newclass;
  20.     }
  21. </script>
  22. <table>
  23. <tr><td>
  24.         <input type="radio" name="Updates" value="yes" onClick="classChange(undisplayed,'DisplayNone')">No
  25.         <br>
  26.      <input type="radio" name="Updates" value="yes" onClick="classChange(undisplayed,'DisplayBlock')">Yes
  27.     <p class="DisplayNone" id="undisplayed">
  28.     <!-- Marker1 --><textarea name="UpdateDetails" cols="70" rows="3"></textarea>
  29.     </p> 
  30.     </td></tr>
  31. </table>
Nov 12 '07 #1
6 1776
gits
5,390 Expert Mod 4TB
hi ...

welcome to TSDN ...

the code you just posted works ... so please post one that is no working ... so that we may have a closer look at it ...

kind regards
Nov 13 '07 #2
Here is another attempt. I have two attempts at the same thing with different javascripts. I can't get either method to recognize the ID tag I am assigning to the text box.

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5.  
  6. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  7. <title>Document Submission Form</title>
  8. <style type="text/css">
  9. body {
  10. font-family:Arial, Helvetica, sans-serif;
  11. }
  12.  
  13. <!-- Classes>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-->
  14. .CourseTitle {
  15. font:"Trebuchet MS", Arial, Helvetica, sans-serif;
  16. font-size:22px;
  17. font-weight:bold;
  18. }
  19.  
  20. .WhiteHeader{
  21. font:"Trebuchet MS";
  22. font-size:20px;
  23. font-weight:bold;
  24. color:#FFFFFF;
  25. }
  26.  
  27. .changedField {
  28.     color: white;
  29.     background-color: navy;
  30. }
  31.  
  32. .currentField {
  33. color:white;
  34. background: red;
  35. }
  36. .greyBG , .greyBG TD, .greyBG TH {
  37. background:#999999;
  38. }
  39.  
  40. .darkgreyBG, .darkgreyBG TD, .darkgreyBG TH {
  41. background-color:#666666;
  42. }
  43. .indent {
  44. padding-left:25px;
  45. }
  46. #CourseIsText{
  47. padding-left:25px;}
  48.  
  49. .DisplayNone{
  50. display:none}
  51.  
  52. .DisplayBlock{
  53. display:block}
  54. </style>
  55.  
  56. <script type="text/javascript">
  57. function classChange(element,newclass) {
  58.     element.className = newclass;
  59.     }
  60. function Show_Stuff(Click_Menu)
  61. // Function that will swap the display/no display for
  62. // all content within span tags
  63. {
  64. if (Click_Menu.style.display == "none")
  65. {
  66. Click_Menu.style.display = "";
  67. }
  68. else
  69. {
  70. Click_Menu.style.display = "none";
  71. }
  72. }
  73. </script>
  74.  
  75. </head>
  76.  
  77. <body>
  78. <form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi"
  79. enctype="multipart/form-data" method="post" name="CourseContent">
  80.   <table cellspacing="0" cellpadding="0" border="1" align="center" frame="void" rules="groups" width="887" >
  81.   <tbody>
  82.   <tr>
  83.     <td colspan="4">
  84.     <div align="center" class="darkgreyBG WhiteHeader"><strong> CONTENT DEVELOPMENT INFORMATION </strong></div></td>
  85.   </tr>
  86.   </tbody>
  87.   <tbody>
  88.   <tr>
  89.     <td colspan="2" valign="bottom" class="greyBG"><div align="center"><strong> State/Vertical </strong></div></td>
  90.     <td width="289" valign="bottom" class="greyBG"><div align="center"><strong> Seat Hours </strong></div></td>
  91.     <td width="178" valign="bottom" class="greyBG"><div align="center"><strong> Credit Hours</strong><strong></strong></div></td>
  92.   </tr>
  93.   </tbody>
  94.   <tbody>
  95.   <tr>
  96.     <td colspan="2"><div align="center"><a name="Text1"></a>
  97.     <input name="SubmitDate" 
  98.     type="text" 
  99.  
  100.     value="" 
  101.     size="50"></div></td>
  102.     <td width="289"><div align="center"><input name="SubmitDate" 
  103.     type="text" 
  104.  
  105.     value="" 
  106.     size="10">
  107.     </div></td>
  108.     <td width="178"><div align="center"><input name="SubmitDate" 
  109.     type="text" 
  110.  
  111.     value="" 
  112.     size="10"></div></td>
  113.   </tr>
  114.   </tbody>
  115.   <tr>
  116.     <td colspan="4"><div align="center" class="greyBG"><strong> COURSE CONTENT </strong></div></td>
  117.   </tr>
  118.   <tbody>
  119.   <tr>
  120.     <td width="353"><p><strong> This course is a: </strong></p>
  121.         <p><strong> &nbsp;</strong></p>
  122.         <p> Note: If this is a revision or update, please include any Course IDs that will be updated. </p></td>
  123.     <td colspan="3">
  124.           <p>
  125.             <input type="radio" name="CourseIs" />New Course</p>
  126.           <p>
  127.     <input type="radio" name="CourseIs" onClick="Show_Stuff(display2)"/>
  128.         Revision or Update to an Existing Course<br/>
  129.           <div class="indent"><span id="display2" STYLE="display: none"><textarea name="RevDetails" cols="70" rows="3"></textarea></span></div>
  130. </td>
  131.   </tr>
  132.   </tbody>
  133.   <tbody>
  134.   <tr>
  135.   <td width="353"><p><strong> This course is a: </strong></p>
  136.         <p><strong> &nbsp;</strong></p>
  137.         <p> Note: If this is a revision or update, please include any Course IDs that will be updated. </p></td>
  138.     <td colspan="3">
  139.  
  140.       <p>
  141.             <input type="radio" name="CourseIs" value="New Course" onClick="classChange(yesno,'DisplayNone')"/>
  142.           New Course</p>
  143.       <p>
  144.         <input type="radio" name="CourseIs" value="revision" onClick="classChange(yesno,'DisplayBlock')"/>
  145.             Revision or Update to an Existing Course<br/>
  146.           </p>
  147.       <div class="indent DisplayNone" id="yesno"><textarea name="RevDetails" cols="70" rows="3"></textarea></div>
  148. </td>
  149.   </tr>
  150.   </tbody>
  151. </table>
  152.  
  153. </body>
  154. </html>
  155.  
Nov 14 '07 #3
gits
5,390 Expert Mod 4TB
hi ...

i think you have to pass the value as a string ... it would be undefined otherwise ... since javascript assumes that is a variable when passing it the way jou did:

Expand|Select|Wrap|Line Numbers
  1. onclick="classChange('yesno', 'DisplayBlock');"
kind regards

ps: the same goes for Show_Stuff('display2');
Nov 15 '07 #4
I don't know what you are suggesting... more javascript code? parentheses?

If i want to use the same javascript function to display/hide various elements do i need to define the value of each instance?

Translation: WHAT?
Nov 15 '07 #5
Dasty
101 Expert 100+
shoudn't it be:

Expand|Select|Wrap|Line Numbers
  1. onClick="classChange(document.getElementById('yesno'),'DisplayNone');"
  2. and
  3. onClick="Show_Stuff(document.getElementById('display2'));"
  4.  
?
Nov 15 '07 #6
gits
5,390 Expert Mod 4TB
shoudn't it be:

Expand|Select|Wrap|Line Numbers
  1. onClick="classChange(document.getElementById('yesno'),'DisplayNone');"
  2. and
  3. onClick="Show_Stuff(document.getElementById('display2'));"
  4.  
?
yes ... of course ;) thanks for pointing that out ...

kind regards
Nov 15 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RU | last post by:
Hi, I am working on a porting project to port C/C++ application from unixware C++, AT&T Standard components to g++ with STL on Linux. This application has been working properly on...
1
by: Stu | last post by:
I am trying to build the xerces shared library with 2.3.0 version of their source code on an AIX 5.1 32 bit machine with the following version of the g++ compiler /usr/local/bin/g++ -v Reading...
4
by: Mike | last post by:
I am having a problem when a field is spaces being undefined. I wasn't sure if the problem was Excel or Javascript, so I thought I would post here first. The users are able to select from a drop...
1
by: Codemutant | last post by:
**** Post for FREE via your newsreader at post.usenet.com **** I just cannot find what is undefined in this code.
1
by: Foolster41 | last post by:
I'm rather new to C++ programing. I'm using the dev-C++ program on a windows XP OS. I'm trying to compile the code for a multi user dungeon (MUD) called circle-mud. When I compile I get the...
13
by: Don Vaillancourt | last post by:
What's going on with Javascript. At the beginning there was the "undefined" value which represented an object which really didn't exist then came the null keyword. But yesterday I stumbled...
4
by: Chris Beall | last post by:
If you want your code to be bulletproof, do you have to explicitly check for the existence of any possibly-undefined variable? Example: window.outerHeight is defined by some browsers, but not...
49
by: matty | last post by:
Hi, I recently got very confused (well that's my life) about the "undefined" value. I looked in the FAQ and didn't see anything about it. On...
3
by: Michael Sgier | last post by:
Hi i get thousands of messages like below. How shall i resolve that? Thanks Mcihael Release/src/Utility/RawImage.o: In function `CMaskImage::CMaskImage(int, int, char const*)':...
45
by: VK | last post by:
(see the post by ASM in the original thread; can be seen at <http://groups.google.com/group/comp.lang.javascript/browse_frm/thread/3716384d8bfa1b0b> as an option) As that is not in relevance to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.