View Full Version : onClick Change Value

05-03-2008, 08:27 PM
Hey all, I got a simple image button that when clicked, i want it to change the value of a hidden text input.
So pretty much, a statement that changes the value of an input.

something like getElementById.name.value=blabla??

no idea, javascript rookie. I searched but couldn't find something like that.

Philip M
05-03-2008, 08:36 PM
<input type = "hidden" name = "txt1" id = "txt1">

<img src = "yourImage.gif" onclick = "change()">

<script type = "text/javascript">
function change() {
document.getElementById("txt1").value = "blahblah"

05-03-2008, 08:49 PM
thanx :)

05-03-2008, 09:12 PM
is there a way to make an onclick link?

like onclick here open a new page... say im at the main index.php now and on click i wnat to open page1.php... (same browser not popup).

Philip M
05-03-2008, 09:42 PM
This is pretty basic! Surely you know how to do this?

<a href = "http://www.yourdomain.com/secondpage.html"> LINK </a>