Json in Javascript -


Trying to learn json due to work req ... I try to dynamically add and remove json objects I am doing ... can someone tell me why I have not received the message .... here is the code ... Thanks for the help!

  & lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Test & lt; / Title & gt; & Lt; Script language = "javascript" type = "text / javascript" & gt; Function addC () {var index = document.getElementById ('type'). SelectedIndex; Var type = document.getElementById ('type'). Option [index] .value; Var Name = document.getElementById ('inpName'). Values; Var date = document.getElementById ('inpDate'). value; ProcessJson (type, name, date); return false; } Function processus (type, name, date) {var count = document.getElementById ('counter'). Value * 1; Var current resholes = document.getElementById ('holder'). Values; Var newRecordType = "{\" name \ ": \" "+ +" \ ","; Var newRecordName = "\" type \ ": \" "+ name +" \ ","; Var newRecordDate = "\" date \ ": \" "+ date +" \ "}"; Var newRecord = newRecordType + newRecordName + new recorddate; If (calculation> 0) {newRecord = "," + newRecord; } Var updatedRecord = currentRecords + newRecord; Var jsonObj = {"allrows": "[" + Update Record + "]"}; Document.getElementById ('counter'). Value = (document.getElementById ('counter'). Value * 1) + 1; . Document.getElementById ('holder') value = updatedRecord; } Function deleteRow () {var toDel = document.getElementById ('inpDel') value; Warning (toDel); Var current = "[" + document.getElementById ('holder'). Value + "]"; Warning (current); Var jsonO = {"allRows": Current}; Warning (jsono); Var t = jsonO.allRows [toDel] type; Warning ("Delete -" + T); return false; } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Form name = "frm" verb = "" & gt; & Lt; Table & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Select name = "type" id = "type" & gt; & Lt; Option value = "creator" & gt; Creator & lt; / Options & gt; & Lt; Option value = "Editor" & gt; Editor & lt; / Options & gt; & Lt; Option value = "Publisher" & gt; Publisher & lt; / Options & gt; & Lt; / Select & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "inpName" id = "inpName" value = "" & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "inpDate" id = "inpDate" value = "" & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "text" name = "inpDel" id = "inpDel" value = "" & gt; & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "button" name = "add CMD" value = "add" onClick = "return addC ();" & Gt; & Lt; Input type = "button" name = "cmdAdd" value = "del" onClick = "return deleteRow ();" & Gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td> & Lt; Input type = "text" name = "counter" id = "counter" value = "0" & ​​gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td colspan = "3" & gt; & Lt; Textarea name = "holder" id = "holder" rows = "20" cols = "60" & gt; & Lt; / Textarea & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

There is a widely used script for use with json:


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -