Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

onchange syntax error

Posted on 2002-07-11
9
Medium Priority
?
356 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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 80 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

715 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