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? - <style>
-
/* Normal style */
-
.normal {
-
font-family: Comic Sans MS, sans-serif;
-
}
-
-
/* Display block */
-
.DisplayBlock {
-
display : block;
-
}
-
/* Display none */
-
.DisplayNone {
-
display: none;
-
}
-
-
</style>
-
<script language="javascript">
-
function classChange(element,newclass) {
-
element.className = newclass;
-
}
-
</script>
-
<table>
-
<tr><td>
-
<input type="radio" name="Updates" value="yes" onClick="classChange(undisplayed,'DisplayNone')">No
-
<br>
-
<input type="radio" name="Updates" value="yes" onClick="classChange(undisplayed,'DisplayBlock')">Yes
-
<p class="DisplayNone" id="undisplayed">
-
<!-- Marker1 --><textarea name="UpdateDetails" cols="70" rows="3"></textarea>
-
</p>
-
</td></tr>
-
</table>
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
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. - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
-
"http://www.w3.org/TR/html4/loose.dtd">
-
<html>
-
<head>
-
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
<title>Document Submission Form</title>
-
<style type="text/css">
-
body {
-
font-family:Arial, Helvetica, sans-serif;
-
}
-
-
<!-- Classes>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>-->
-
.CourseTitle {
-
font:"Trebuchet MS", Arial, Helvetica, sans-serif;
-
font-size:22px;
-
font-weight:bold;
-
}
-
-
.WhiteHeader{
-
font:"Trebuchet MS";
-
font-size:20px;
-
font-weight:bold;
-
color:#FFFFFF;
-
}
-
-
.changedField {
-
color: white;
-
background-color: navy;
-
}
-
-
.currentField {
-
color:white;
-
background: red;
-
}
-
.greyBG , .greyBG TD, .greyBG TH {
-
background:#999999;
-
}
-
-
.darkgreyBG, .darkgreyBG TD, .darkgreyBG TH {
-
background-color:#666666;
-
}
-
.indent {
-
padding-left:25px;
-
}
-
#CourseIsText{
-
padding-left:25px;}
-
-
.DisplayNone{
-
display:none}
-
-
.DisplayBlock{
-
display:block}
-
</style>
-
-
<script type="text/javascript">
-
function classChange(element,newclass) {
-
element.className = newclass;
-
}
-
function Show_Stuff(Click_Menu)
-
// Function that will swap the display/no display for
-
// all content within span tags
-
{
-
if (Click_Menu.style.display == "none")
-
{
-
Click_Menu.style.display = "";
-
}
-
else
-
{
-
Click_Menu.style.display = "none";
-
}
-
}
-
</script>
-
-
</head>
-
-
<body>
-
<form action="http://www.cs.tut.fi/cgi-bin/run/~jkorpela/echo.cgi"
-
enctype="multipart/form-data" method="post" name="CourseContent">
-
<table cellspacing="0" cellpadding="0" border="1" align="center" frame="void" rules="groups" width="887" >
-
<tbody>
-
<tr>
-
<td colspan="4">
-
<div align="center" class="darkgreyBG WhiteHeader"><strong> CONTENT DEVELOPMENT INFORMATION </strong></div></td>
-
</tr>
-
</tbody>
-
<tbody>
-
<tr>
-
<td colspan="2" valign="bottom" class="greyBG"><div align="center"><strong> State/Vertical </strong></div></td>
-
<td width="289" valign="bottom" class="greyBG"><div align="center"><strong> Seat Hours </strong></div></td>
-
<td width="178" valign="bottom" class="greyBG"><div align="center"><strong> Credit Hours</strong><strong></strong></div></td>
-
</tr>
-
</tbody>
-
<tbody>
-
<tr>
-
<td colspan="2"><div align="center"><a name="Text1"></a>
-
<input name="SubmitDate"
-
type="text"
-
-
value=""
-
size="50"></div></td>
-
<td width="289"><div align="center"><input name="SubmitDate"
-
type="text"
-
-
value=""
-
size="10">
-
</div></td>
-
<td width="178"><div align="center"><input name="SubmitDate"
-
type="text"
-
-
value=""
-
size="10"></div></td>
-
</tr>
-
</tbody>
-
<tr>
-
<td colspan="4"><div align="center" class="greyBG"><strong> COURSE CONTENT </strong></div></td>
-
</tr>
-
<tbody>
-
<tr>
-
<td width="353"><p><strong> This course is a: </strong></p>
-
<p><strong> </strong></p>
-
<p> Note: If this is a revision or update, please include any Course IDs that will be updated. </p></td>
-
<td colspan="3">
-
<p>
-
<input type="radio" name="CourseIs" />New Course</p>
-
<p>
-
<input type="radio" name="CourseIs" onClick="Show_Stuff(display2)"/>
-
Revision or Update to an Existing Course<br/>
-
<div class="indent"><span id="display2" STYLE="display: none"><textarea name="RevDetails" cols="70" rows="3"></textarea></span></div>
-
</td>
-
</tr>
-
</tbody>
-
<tbody>
-
<tr>
-
<td width="353"><p><strong> This course is a: </strong></p>
-
<p><strong> </strong></p>
-
<p> Note: If this is a revision or update, please include any Course IDs that will be updated. </p></td>
-
<td colspan="3">
-
-
<p>
-
<input type="radio" name="CourseIs" value="New Course" onClick="classChange(yesno,'DisplayNone')"/>
-
New Course</p>
-
<p>
-
<input type="radio" name="CourseIs" value="revision" onClick="classChange(yesno,'DisplayBlock')"/>
-
Revision or Update to an Existing Course<br/>
-
</p>
-
<div class="indent DisplayNone" id="yesno"><textarea name="RevDetails" cols="70" rows="3"></textarea></div>
-
</td>
-
</tr>
-
</tbody>
-
</table>
-
-
</body>
-
</html>
-
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: - onclick="classChange('yesno', 'DisplayBlock');"
kind regards
ps: the same goes for Show_Stuff('display2');
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?
shoudn't it be: -
onClick="classChange(document.getElementById('yesno'),'DisplayNone');"
-
and
-
onClick="Show_Stuff(document.getElementById('display2'));"
-
?
gits 5,390
Expert Mod 4TB
shoudn't it be: -
onClick="classChange(document.getElementById('yesno'),'DisplayNone');"
-
and
-
onClick="Show_Stuff(document.getElementById('display2'));"
-
?
yes ... of course ;) thanks for pointing that out ...
kind regards
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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.
|
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...
|
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...
|
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...
|
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...
|
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*)':...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
| |