Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

javascript - Unexpected token } -


i have script open model window.. chrome gives me "uncaught syntaxerror: unexpected token }" on line doesn't have closing curly brace.

here portion of script has error:

function showm(id1){   window.onscroll=function(){document.getelementbyid(id1).style.top=document.body.scrolltop;};   document.getelementbyid(id1).style.display="block";   document.getelementbyid(id1).style.top=document.body.scrolltop; } 

does have ideas on this? appreciated.

try running entire script through jslint. may point @ cause of error.

edit ok, it's not quite syntax of script that's problem. @ least not in way jslint can detect.

having played live code @ http://ft2.hostei.com/ft.v1/, looks there syntax errors in generated code script puts onclick attribute in dom. browsers don't job of reporting errors in javascript run via such things (what file , line number of piece of script in onclick attribute of dynamically inserted element?). why confusing error message in chrome. firefox error message different, , doesn't have useful line number, although firebug show code causes problem.

this snippet of code taken edit function in inline script block of html:

var sub = document.getelementbyid('submit'); ... sub.setattribute("onclick", "save(\""+file+"\", document.getelementbyid('name').value, document.getelementbyid('text').value"); 

note sets onclick attribute of element invalid javascript code:

<input type="submit" id="submit" onclick="save("data/wasup.htm", document.getelementbyid('name').value, document.getelementbyid('text').value"> 

the js is:

save("data/wasup.htm", document.getelementbyid('name').value, document.getelementbyid('text').value 

note missing close paren finish call save.

as aside, inserting onclick attributes not modern or clean way of adding event handlers in javascript. why not using dom's addeventlistener hook function element? if using jquery, simpler still.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -