User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » A way to write to an arbitrary spot on a web page? Page [1]  
Kris
All American
36908 Posts
user info
edit post

I'd think there is some way to do it using document.write, but I've never really used that function extensively. Additionally I'd need to do some kind of regular expression search to find exactly where to write to the page, and I'm not sure if javascript offers that functionality.

Any HTML/Javascript wizards have any ideas?

5/23/2006 12:34:02 AM

qntmfred
retired
40726 Posts
user info
edit post

<span style="position:absolute;top:13px;right:37px">hello world</span>

5/23/2006 7:57:52 AM

marilynlov7
All American
650 Posts
user info
edit post

http://www.webreference.com/js/column5/

5/23/2006 9:47:25 AM

Kris
All American
36908 Posts
user info
edit post

^^That's close, but I need to actually interact with the text on the page, for example if I were premie, I could post some HTML/Javascript to comment out my name and replace it with "Your Daddy" or something of that nature.

^sweet, that takes care of the regular expressions, thanks!

[Edited on May 23, 2006 at 11:19 AM. Reason : ]

5/23/2006 11:19:22 AM

qntmfred
retired
40726 Posts
user info
edit post

well since html is dead now, i guess it can be posted, for the sake of learning, right

[image]http://www.thewolfweb.com/images/new.gif" onload="for(var t=0;t<document.getElementsByTagName('B').length;t++){b=document.getElementsByTagName('B')[t].firstChild;b.nodeValue=b.nodeValue.replace('Kris','haxor');}[/image]

[Edited on May 23, 2006 at 11:33 AM. Reason : or use the innerhtml property]

5/23/2006 11:32:04 AM

Kris
All American
36908 Posts
user info
edit post

OK, I've almost got that. I guess I'll get into the specifics.
onload="document.getElementsByID('_ctl0_lnk').setAttribute('href','error_500.aspx');"

This is what I have right now, but it's not doing what I want. I've got it onloading with an embed tag, basically what I want it to do is replace whatever is in the href attribute of the tag with id _ctl0_lnk with error_500.aspx. This tag is located later in the page than this part of the code. What am I doing wrong here?

5/23/2006 12:45:39 PM

Stein
All American
19842 Posts
user info
edit post

There's no such thing as getElementsById

You have getElementById and you have getElementsByTagName

5/23/2006 1:14:49 PM

Kris
All American
36908 Posts
user info
edit post

oh shit, that's probably it

5/23/2006 1:59:44 PM

 Message Boards » Tech Talk » A way to write to an arbitrary spot on a web page? Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.