?
Solved

select onchange javascript giving 'expected end of statement' (should be easy points)

Posted on 2003-03-25
6
Medium Priority
?
192 Views
Last Modified: 2012-06-27
I can't for the life of me see why this is giving this error.  If anyone can help it would be greatly appreciated. Thanks

<select name="cid" class="requiredField" size="1" onchange="location.href='inp_listings_newlisting.asp?cid='+this.options[this.selectedIndex].value">
<option selected>SELECT CLIENT</option>
<option value=1123>Bee, Benjamin</option>
<option value=1052>Bourne, Karen</option>
</select>
0
Comment
Question by:zrodriguez
[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
 

Author Comment

by:zrodriguez
ID: 8204056
BTW, the error is generated on page load not when the menu is changed.
0
 

Expert Comment

by:Asp
ID: 8204244
It works fine with me....

<html>
<body>
<select name="cid" class="requiredField" size="1" onchange="location.href='inp_listings_newlisting.asp?cid='+this.options[this.selectedIndex].value">
<option selected>SELECT CLIENT</option>
<option value=1123>Bee, Benjamin</option>
<option value=1052>Bourne, Karen</option>
</select>
</body>
</html>

most simpel form, nothing wrong i guess
0
 

Author Comment

by:zrodriguez
ID: 8213280
I just tried this as posted and it did work however this page is part of a much bigger page which has a vbscript validation included with it.  I didn't think it would matter but appearantly it does.  Anybody have any ideas why this would case this error.  I would post the page but it is huge and the vbscript is actually included in a src statement so it would be multiple pages to post.  If anyone can give me some ideas it would be great.  Thanks
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Author Comment

by:zrodriguez
ID: 8213333
Answered my own question!

With the vbscript declaration in the include the browser attempts to process the javascript using the vbscript parses.  This obviously will not work.  I changed the above code to what is below(added the "javascript" in the onChange tag) and it worked like a charm.

<select name="cid" class="requiredField" size="1" onchange="javascript:location.href='inp_listings_newlisting.asp?cid='+this.options[this.selectedIndex].value">
<option selected>SELECT CLIENT</option>
<option value=1123>Bee, Benjamin</option>
<option value=1052>Bourne, Karen</option>
</select>
0
 
LVL 16

Expert Comment

by:jaysolomon
ID: 10149818
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

PAQ with points refunded

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

jAy
EE Cleanup Volunteer
0
 

Accepted Solution

by:
SpazMODic earned 0 total points
ID: 10204376
PAQed, with points refunded (20)

SpazMODic
EE Moderator
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 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