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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easy way to update Paragraph using document.write?

Status
Not open for further replies.

jswift

Technical User
Oct 19, 2002
2
US
Is there a way to update a specific paragraph with the Javascript: document.write statement? The Idea being to update certain paragraphs whose names would be known with a div or p id= type indentifer ahead of time,and would not change. I was trying to avoid getElementbyID because of the paragraph names not changing as links were clicked.

Or, is there some way to use <SCRIPT language=&quot;JavaScript&quot; src=&quot;test.js&quot;>
</SCRIPT> with an onclick statement in a hyperlink?

I've been looking online for 3-4 days for a page that might have this information, but I can't seem to come up with the right combination of search terms...

Maybe I'm on the wrong track to solving this...

I am looking for an alternative to reloading the page every time a link is clicked, in order to keep the page load time down. I've done this previously with HTML using frames and #/P id, but the results were less than spectacular. This need only apply to IE, since I send all my &quot;other&quot; browser users (< .10) to a stripped down version of my page now, and plan to send all non IE users to text only after the intro page. If it's possible with VBScript instead of JS, that's even better, since I'm more comfortable with VB.


Regards,


Jonathan

 

how about something like...

***
<script>

function chngtxt() {document.all.txt.innerText='and here is some more text.';}

</script>

<br><br>

<table>
<tr>
<td><input type=button value=change onclick=chngtxt();><td id=txt>here is some text,</td>
</tr>
</table>
***

works in ie5. i know this isn't document.write(), but i was put on to this recently to change images and text without having to reload, such as your situation.

- spewn
 
will work in all standard compliant browsers if you replace this part :

document.all.txt.innerText

with :

document.getElementById('txt').innerHTML

I hope this helps. Gary Haran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top