0

I have resorted to everything I can think of and I can't get a PHP variable to go into a form that is onclicked with a Javascript Function...

Here is my attempts thus far:

  1. Give the div that contains the onclick function the php variable as an id, and then attempt to extract the id in the Javascript function. I can't get the javascript to pull the id of the div using this.parentNode.id or getElementsByTagName.id or related methods.

    <div id="tom" getID()>

    function getID(){
    var id = document.getElementsByTagName("div")
    alert(id.id);
    }

    or

    function getID{
    var id=this.parentNode.id
    alert(id.id)
    }

Pulling my hair out I only have a few left..

3
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by Airshow
0

jckb188,

Need a bit more to go on:

  • "get a PHP variable" : How served; as part of the original page or in response to an AJAX call?
  • "to go into a form": What part of the form; as an attribute of the form tag, as a value of an input element, ...?
  • "that is onclicked with a Javascript Function": What is clicked? It's not particularly normal to attach an onclick event to a form.

What are acually trying to achieve?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.