...

View Full Version : onClick Change Value



Erindesign
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"
}
</script>

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

Erindesign
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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum