Javascript get id
2 answers
The function document.getElementId()
returns the value of an object based on the ID string that you supply; so if your page has an element with id foo
, then you call
document.getElementById("foo");
to return an object for that element so you can manipulate it (changing styles or attributes, etc.).
If you want to embed the id in the url of the test.php page, why not just pass the id string of the element you pass using the function ?:
function check(id){
url = "test.php?check=1&id=" + id;
}
Then call
check("123");
will set the variable url
totest.php?check=1&id=123
+4
a source to share