?
Solved

html and javscript problem

Posted on 2003-03-28
6
Medium Priority
?
129 Views
Last Modified: 2010-04-09
hi I have this code but when i run it it gives me run time error where i have defined the Form . It says Object expected.
Will appreciate any help.

<script language="Javascript/text">
function checkForm(myForm)
{
var thisForm = myForm;
If (thisForm.selectBooks.value=="")
{
return();
}
else
thisForm.submit();

}
</script>

//error is here It says object expected?
<FORM name="AABooks" method="post" action="sell_Books.php;">
<p>
<SELECT name="selectBooks" onChange="checkForm(document.AABooks);" style="font-size='13px'; font-family='MS Sans Serif'; font-weight=500; font-style='Normal'; text-decoration='None'; width=">
<OPTION value="" SELECTED style="background-color='';color=''">Select
<OPTION value="">-----------------------------

thanks

0
Comment
Question by:dskaushik
[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
6 Comments
 
LVL 5

Accepted Solution

by:
russellshome earned 80 total points
ID: 8228916
You have a number of faults in your code. The one causing "object expected" error is caused by using language="Javascript/text".

Either use
<script type="text/javascript">

or
<script language="javascript">

Here is something that works (use indentation to reveal problems in your javascript code):

<script type="text/Javascript">
function checkForm(mySelector) {
     if (mySelector.value=="") {
          return;
     } else {
          mySelector.form.submit();
     }
}
</script>

<FORM name="AABooks" method="post" action="sell_Books.php">
<p>
<SELECT name="selectBooks" onChange="checkForm(this);" style="font-size='13px'; font-family='MS Sans Serif'; font-weight=500; font-style='Normal'; text-decoration='None'; width=''">
<OPTION value="" SELECTED style="background-color='';color=''">Select
<OPTION value="">-----------------------------
<OPTION value="something">Submit the form
</SELECT>
</FORM>

0
 
LVL 1

Expert Comment

by:umangjoshi
ID: 8230141
pls change this part

onChange="checkForm(document.AABooks);"

to

onChange="checkForm(AABooks);"
0
 

Expert Comment

by:vitanza
ID: 8232659
here is another problem - on this line:

<FORM name="AABooks" method="post" action="sell_Books.php;">

you should get rid of the semicolon after "sell_Books.php"
because you have the semicolon, the browser thinks sell_Books.php is javascript code
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 8820623
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
 
LVL 5

Expert Comment

by:russellshome
ID: 8859389
Recommendation: Points to me. I have answered by pointing out the cause of the error AND providing an alternative.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 9016117
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
pointst to russellshome

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

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

Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Suggested Courses

762 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