Working with Javascript and ASP

Status
Not open for further replies.

desertwind

Cyborg Agent
I want to call a js function on the onClick event of a checkbox, which is written inside an asp snippet.

this is the code

Response.Write "<input type=checkbox name=idxModify checked=true value='"&objRS("ID")&"' onClick="checkValue()" >"

it gives me "unexpected end of statement" error by asp.

I also tried

Response.Write "<input type=checkbox name=idxModify checked=true value='"&objRS("ID")&"' onClick='"checkValue()"' >"

Still seems not working. Any clues ?
 

parthbarot

In the zone
try

Response.Write "<input type='checkbox' name='idxModify' checked='true' value='"&objRS("ID")&"' onClick='checkValue();'></input>"

and if this also not works then may be u have problem in objRS("ID").. instead put objRS('ID') or objRS(\"ID\")..i mean use escape sequences for chars..if its not working....

regards,
Paarth.
 

tuxfan

Technomancer
desertwind said:
value='"&objRS("ID")&"'
This is where the problem lies. It treats "&objRS(" as one string and ")&" as another string. ID doesn't belong anywhere. It is expecting something more when that close double quote is encountered after RS(
 
OP
desertwind

desertwind

Cyborg Agent
But

Response.Write "<input type=checkbox name=idxModify checked=true value='"&objRS("ID")&"' >"

works fine and give expected results. only thing is that javascript is not evoked when called on onClick event.
 

enjoy

Journeyman
Instead of <input type=checkbox name=idxModify checked=true value='"&objRS("ID")&"' >

use

"<input type=checkbox name=idxModify checked=true value=" & chr(34) & " & "objRS(" & chr(34) & "ID" & chr(34) & ")&" & chr(34) & ">"

Chr(34) is same as double quotes.
 
Status
Not open for further replies.
Top Bottom