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 - Replacing DIV content based on variable sent from another HTML file -


i'm trying javascript working:

i have html email links page contains variable in link (index.html?content=email1). javascript should replace div content depending on variable 'content' is.

<!-- original div --> <div id="email">  </div>   <!-- div replacement function -->  <script type="text/javascript"> function replacecontentincontainer(id,content) { var container = document.getelementbyid(id); container.innerhtml = content; } </script>  <!-- email 1 content --> <script ="text/javascript"> var content = '<div class="test">email 1 content</div>';  replacecontentincontainer('email1',content); } </script>  <!-- email 2 content --> <script ="text/javascript"> var content = '<div class="test">email 2 content</div>';  replacecontentincontainer('email2',content); } </script> 

any ideas i've done wrong causing not work?

rather inserting element text innerhtml create dom element, , append manually so:

var obj = document.createelement("div"); obj.innertext = "email 2 content"; obj.classname = "test"  document.getelementbyid("email").appendchild(obj); 

see working here: http://jsfiddle.net/be8xa/1/

edit

interesting reading decide if want use innerhtml or appendchild:

"innerhtml += ..." vs "appendchild(txtnode)"


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 -