Click to See Complete Forum and Search --> : using java to alter preset html elements on a page


kyzen
07-28-2003, 01:02 PM
Hey, at one point awhile I ago recalled reading somewhere how java could be used to alter an element on an HTML page that has allready been defined, like the background color, or an image, etc. At that time I didn't pay attention to it, but right now it would be really helpfull to know. If anybody could explain this to me, maybe with some examples, or point me towards something that explains it, it would be very appreciated.

Nevermore
07-28-2003, 01:26 PM
JavaScript can do all that, but doing each one is different. Which do you want to do?

kyzen
07-28-2003, 01:53 PM
Let's start with changing an image

By the way, in case you needed more information the way this is set up is kind of inconvenient. How this is working is I'm updating a website through a form, however the content of the form is pasted into a cell of a table on the page. The elements I am trying to alter are in other cells on the table.

After I change the image, i'd like to change the background color in other cells, though I'm not sure if that is possible.

Nevermore
07-28-2003, 01:58 PM
To change the source of an image, firstly give the image an id. Then use this code (I am assuming you know how to call JavaScripts, if not, ask).

document.getElementById('your_image_id').src='new_source.gif';

kyzen
07-28-2003, 03:00 PM
I actually don't know how to call javascripts... yeah I'm an idiot hehe

kyzen
07-31-2003, 12:59 PM
So... still looking for help on how to call Javascripts and if it's possible to change background elements.

Nevermore
07-31-2003, 03:14 PM
Sorry I didn't help, but I'm on holiday. I haven't got time to write you an explanation, since it's hard to explain (but not to do), but here's a tutorial: http://hotwired.lycos.com/webmonkey/programming/javascript/tutorials/tutorial1.html
and if u need any more help I'm sure the guys here will answer your questions.