HTML - Innerhtml - How Do I?
After reading a mysql database with php, is it possible then to display the php variable using the innerHTML value property? (As in innerHTML="<input type='text' name='reference' value= '' size='30' />"; )
Similar TutorialsHow can I use innerhtml to add text inside a table consist of texts? i've designed my page as: HTML Code: <div class="yesVisible" id="loginFormDiv" name="loginFormDiv"> <form method="get" id="loginForm" name="loginForm" onsubmit="validate(this)" > <input type="text" size="10 /> <img src="login.gif" name="loginImg" id="loginImg" /> </form> </div> And the validator function is as follows: Code: function validate(form) { var v= document.getElementById("loginFormDiv"); // print a line saying loggin in and show an icon in the login div v.innerHTML=" <h1> loging in... </h1>" + "<img src=\"loadin.gif\" />" alert("validating"); // later other ajax code will be here return false; } But unfortunately this code is not working...........What should i do ???? This code is intended to let users a feeling that they are loggin in...... The website will be made for: http://www.favourite9site.com/blog hi guys, ive got a quiz box (its rubbish but its for an assignement) and atm my results pop up in an alert box, how would i get the results to be written into a div on my html page? thanks for any help. sam Code: var ans = new Array; var done = new Array; var yourAns = new Array; var explainAnswer = new Array; var score = 0; ans[1] = "b"; ans[2] = "b"; ans[3] = "a"; ans[4] = "c"; ans[5] = "b"; explainAnswer[1]="Roar is Blackburn's mascot"; explainAnswer[2]="John Coleman is Accrington's manager"; explainAnswer[3]="The picture was infact David Beckham"; explainAnswer[4]="The golden oldie Ryan Giggs was PFA Player of the year"; explainAnswer[5]="The reason why Answer 5 is Blah Blah Blah"; function Engine(question, answer) { yourAns[question]=answer; } function Score(){ var answerText = "How did you do?\n------------------------------------\n"; for(i=1;i<=5;i++){ answerText=answerText+"\nQuestion :"+i+"\n"; if(ans[i]!=yourAns[i]){ answerText=answerText+"\nThe correct answer was " +ans[i] + "\n"+explainAnswer[i]+"\n"; } else{ answerText=answerText+" \nCorrect! \n"; score++; } } answerText=answerText+"\n\nYour total score is : "+score+"\n"; //now score the user answerText=answerText+"\nComment : "; if(score<=0){ answerText=answerText+"You need to learn some more"; } if(score>=1 && score <=1){ answerText=answerText+"Bit more practice needed"; } if(score>=2 && score <=2){ answerText=answerText+"Bit more practice needed"; } if(score>=3 && score <=3){ answerText=answerText+"Neither bad or birlliant. Good effort"; } if(score>=4 && score <=4){ answerText=answerText+"4/5 aint bad!"; } if(score>4){ answerText=answerText+"You are a footballing expert!!"; } alert(answerText); } I want to make a table, like the "legend" of a map, showing how different line styles correspond to road type (dirt, gravel, paved, etc.). In the first column of each row, I want to place a <canvas> and make the line by drawing in that canvas. To top it off, I want this table to be dynamic, only showing road types currently in use. So I make a table with a header row, and add rows using the .insertRow() method of DOM Table. Then I insert a cell in it using tr insertCell(). Then I create an innerHtml string. After escaping lots of doublequotes, my innerHtml string logs thus: <canvas id="line0" width="80" height="2" style="position:absolute"></canvas> Then I create a cell using DOM tr insertCell(0), and then newCell.innerHtml = myInnerHtmlString ; How can I access that canvas object so I can draw my line? My first attempt, document.getElementById("line0") returns null. I also tried to access it by drilling down. Even though the newCell.innerHtml logs as expected, newCell.childNodes is an empty NodeList, and indeed the DOM tree in the browser shows newCell as as empty, <td></td> It's like my canvas object is not really there yet. Same problem if I set innerHtml to "Hello World". Or am I doing this all wrong? Thanks, Jerry Krinock |