Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamically modify text 2

Status
Not open for further replies.

werjocks

Programmer
Oct 27, 2003
24
0
0
US
Im trying to modify text and links on a page without reposting to the server. I've been trying to use innertext to change a paragraph element with some success, but the links dont evaluate as html elements. Is there a good way to achieve this?

Example code:

<html>
<head>
<script type="text/javascript">
function changetext()
{
document.getElementById('avar').innerText="More stuff <a href=\"}
</script>
</head>

<body>
<p id="avar">Some stuff <a href="<form>
<input type="button" onclick="changetext()" value="Next">
</form>
</body>

</html>
 
have you tried

Code:
var p = document.getElementById('avar');
var new = "More stuff <a href='[URL unfurl="true"]http://www.aLink2.com/'>Link2</a>";[/URL]
p.inner[red]HTML[/red] = new;

*cLFlaVA
----------------------------
[tt]a frickin' twelve-gauge, what do you think?[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
<html>
<head>
<script type="text/javascript">
function changetext(){
document.getElementById('avar').innerHTML="More stuff <a href=\"}
</script>
</head>

<body>
<p id="avar">Some stuff <a href="<form>
<input type="button" onclick="changetext()" value="Next">
</form>
</body>

</html>
 
not sure which method was prefered but remember those who helped you along the way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top