?
Solved

Javascript "AdviceBox" Doesn't Work with NS4

Posted on 2003-02-23
9
Medium Priority
?
223 Views
Last Modified: 2013-11-19
I'm trying to add an "AdviceBox" to a form. The AdviceBox works with IE5 and NS6, but I can't seem to get it to work with NS4. Here's the URL:

http://www.msdetta.com/design.html#form

Thanks in advance for your help.

MsDetta
0
Comment
Question by:MsDetta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 5

Expert Comment

by:gator4life
ID: 8004948
The getElementById() method, as in:

document.getElementById("adviceBox").value = helpers[adviceNumber];

did not exist in NS4.x.  This method is part of the Document Object Model (DOM) Level 1 specification and is only available in modern browsers (IE5.0+, NS6.0+, etc.).

If you want to set something like this up in NS4.x, you have to create a separate <layer> for each message that you want to have, and then you dynamically show or hide these layers with onMouseOver and onMouseOut events.  These layers would also have to dynamically replace the area where the current <textarea> is.  So, this would require you to use conditionals and the document.write() method to put the right content into the browser based on browser type.

gator4life
(chomp, chomp)
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 100 total points
ID: 8004977
Make this change:

function messages(adviceNumber) {
   //document.getElementById("adviceBox").value = helpers[adviceNumber];
   document.FORM1.adviceBox.value = helpers[adviceNumber];
}

Good luck,
Zvonko

0
 
LVL 63

Expert Comment

by:Zvonko
ID: 8004994
Or this version:

function messages(adviceNumber) {
   //document.FORM1getElementById("adviceBox").value = helpers[adviceNumber];
   //document.FORM1.adviceBox.value = helpers[adviceNumber];
   MM_findObj("adviceBox").value = helpers[adviceNumber];
}

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 5

Expert Comment

by:gator4life
ID: 8005103
Thanks Zvonko, I forgot you could do it that way! : )
0
 

Author Comment

by:MsDetta
ID: 8005178
Neither of those suggestions worked to add the AdviceBox to NS4. Do I need to add appName if statements?

I'm also having another problem in that my checkForm.js is not working and the form is being submitted to email without the data validation. Any and all suggestions are deeply appreciate.
0
 
LVL 5

Assisted Solution

by:gator4life
gator4life earned 100 total points
ID: 8005216
MsDetta -

I don't know why the suggestions Zvonko gave aren't working right now, but I do have an answer for your second question.

In your code, you have:

<script type="text/javascript" language="JavaScript" src="checkForm.js">
     // Set form element object properties to event-handler functions
     document.FORM1.onSubmit = checkFormData();
</script>

and then:

<form name="FORM1" onSubmit="checkForm.js" method="POST" action="/cgi-sys/formmail.pl">

This is the incorrect way to set up form validation.

Change those areas of code to this:

<script type="text/javascript" src="checkForm.js"></script>

and this:

<form name="FORM1" onSubmit="return checkFormData();" method="POST" action="/cgi-sys/formmail.pl">

gator4life
(chomp, chomp)
0
 

Author Comment

by:MsDetta
ID: 8005670
Gator4life,

Thanks so much :) The form now validates and works in IE5 and NS6. I still can't figure out why the "AdviceBox" doesn't work in NS4.

I'll try checking the browser as I've already got a ckBrowser.js script working.

Thanks for the help.

MsDetta
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10083359
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area:
RECOMMENDATION:

 - [Split Zvonko / gator4life]

Please leave any comments here within the next seven days.
*******************************************************
******PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER******
*******************************************************

jAy
EE Cleanup Volunteer
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question