Gunnar Adler

How can I change the text portion of a paragraph or span element through script Cheers!

Code Snippet

<button><p id="buttontext">CHANGE ME</p></button>



Re: HD DVD Interactivity Authoring Changing text in p/span elements through script

Amy Dullard - MSFT

for a paragraph, you need to modify the dom and reload the document. I would not recommend this. Use an input tag (mode="display") instead.




Re: HD DVD Interactivity Authoring Changing text in p/span elements through script

Gunnar Adler

Thank you. I totally forgot about reloading...
But I'm still curious how to change this. Any idea




Re: HD DVD Interactivity Authoring Changing text in p/span elements through script

Amy Dullard - MSFT

Code Snippet

<!--markup-->

<div id="sampleDiv" style:position="absolute" style:x="0px" style:y="0px" style:width="1800px" style:height="900px">

<input id="sampleInput" mode="display" style:font="font.ttf" style:fontSize="24px" state:value="" />

</div>


//script
document.sampleInput.state.value = "your text goes here";






Re: HD DVD Interactivity Authoring Changing text in p/span elements through script

Gunnar Adler

Thank you Amy but you misunderstood. I know how to handle inputs but I'm still curious how to change the content of paragraphs even if it's not practical to do this at all. Thanks again!




Re: HD DVD Interactivity Authoring Changing text in p/span elements through script

Amy Dullard - MSFT

Code Snippet

<!-- markup -->
<div id="editArea" style:position="absolute" style:fontSize="40px" style:font="font.ttf" style:x="500px" style:y="200px" style:width="1000px" style:height="500px"></div>


//script
var p = document.createElement( "p" );
var txt = document.createTextNode("this is my sample txt");
p.appendChild( txt );
document.editArea.appendChild(p);
document.load();