Solved

onchange syntax error

Posted on 2002-07-11
9
351 Views
Last Modified: 2008-03-10
in asp/vbscript i try to do this javascript




response.write ourSymbol & "<input type=text name='IT" & rs.fields.item("ProductID") & "' size=6

onChange='alert('This is a calculated field')'>"


which gives


&euro;<input type=text name='IT27' size=6 onChange='alert('This is a calculated field')'>


but it says theres a syntax error??
0
Comment
Question by:boofulls
[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
  • 4
  • 3
  • 2
9 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 7145916
onChange='alert(\'This is a calculated field\')'>
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7145920
Try this:
response.write "<<script>var msg1 = 'This is a calculated field'</script>"
response.write ourSymbol & "<input type=text name='IT" & rs.fields.item("ProductID") & "' size=6 onChange='alert(msg1)'>"

Good luck,
zvonko



0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7145927
or, if you want double-quotes in VBScript, then you double them:

response.write ourSymbol & "<input type='text' name='IT" & rs.fields.item("ProductID") & "' size='6'
onChange='alert(""This is a calculated field"")'>"
0
Industry Leaders: 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!

 
LVL 10

Expert Comment

by:zvonko
ID: 7145933
Sorry, a typo. Here corrected:
Try this:
response.write "<script>var msg1 = 'This is a calculated field'</script>"
response.write ourSymbol & "<input type=text name='IT" & rs.fields.item("ProductID") & "' size=6 onChange='alert(msg1)'>"

Of course is a better idea to place all strings into variables in <head> section.

Cheers,
zvonko

0
 

Author Comment

by:boofulls
ID: 7146075
knighteknight

i try this

or, if you want double-quotes in VBScript, then you double them:

response.write ourSymbol & "<input type='text' name='IT" & rs.fields.item("ProductID") & "' size='6'
onChange='alert(""This is a calculated field"")'>"


it works but when i edit the field it stays edited, i want it to not editable

thanks
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 20 total points
ID: 7146085
try adding this in the tag:

onFocus='this.blur();'
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 7146088
... instead of the onChange (which is not needed if that is all you want to do)
0
 

Author Comment

by:boofulls
ID: 7146090
zvonko


this works too

response.write "<script>var msg1 = 'This is a calculated field'</script>"
response.write ourSymbol & "<input type=text name='IT" & rs.fields.item("ProductID") & "' size=6 onChange='alert(msg1)'>"



but again id like the field to not be editable

thanks
0
 
LVL 10

Expert Comment

by:zvonko
ID: 7146188
Hey, this is experts exchange :)

0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…

735 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