Solved

onchange syntax error

Posted on 2002-07-11
9
350 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
  • 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
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…

831 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