|
FlowerPower -> Javascript set text in HTML element (4/27/2004 19:28:27)
|
Greetings - first post here... This may not be a true newbie question, but then I don't feel that experienced still, so I'll ask it here anyway. I have a page where I want to display a random quote on the index page when it opens in the browser. I have made a javascript function that is called in the <body onload> tag. It generates a random number and runs a switch sentence to select from a pool of quotes and depending on the case sets one of these quotes as the text of a string variable. This all works well. The problem is that I then want to display this text in a particular location, e.g. a <p> or <div> or <span> or <table>. I'd rather not use a form element, as a textbox or similar would clash with the look of the page. I don't know how to specify that the string variable should be displayed in the HTML element. document.write overwrites the rest of the stuff in the page (it's a menu sidebar in a frames page, and I have a DHTML pulldown menu higher up on this page - I want to display the quote below the menu). Any ideas will be received gratefully! FlowerPower :o)
|
|
|
|