I'm currently trying to modify 2 scripts to work together. I've gotten everything working except the script isn't passing any, or the incorrect information when it's trying to create a checkbox. Here's the code I have so far:

if (strlen($q)>0)
for($i=0; $i<($x->length); $i++)
  if ($y->item(0)->nodeType==1)
    //find a link matching the search text
    if (stristr($y->item(0)->childNodes->item(0)->nodeValue,$q))
      if ($hint=="")
        $iteration = 0;
        $hint="<a id='item' href='javascript:void(0)' onClick='add()'>" . 
        $g->item(0)->childNodes->item(0)->nodeValue . "</a>";
        $hint=$hint . "<br /><a id='item' href='javascript:void(0)' onClick='add()'>" . 
        $g->item(0)->childNodes->item(0)->nodeValue . "</a>";

The code "$g->item(0)->childNodes->item(0)->nodeValue" is the name of whatever item is being pulled at the current time.

Here's the javascript function for creating the checkboxes:

var i=0;
function add(){  
if (document.getElementById('item').value!='') 
        var title = document.getElementById('item').value;
        var node = document.createElement('div');        
        node.innerHTML = '<input type="checkbox" id="check' + i + '" name="check' + i + '"><label for="check' + i + '">' + title + '</label>';       

And the script is being used in this fasion:

    <input type="text" size="30" onkeyup="showResult(this.value)">

    <div id="livesearch"></div>

If I'm not making the code clear, please comment on what needs to be clarified. Any help is appreciated!

Edited by pritaeas: Moved.

4 Years
Discussion Span
Last Post by stultuske

This is the Java forum, but that's not Java code.
Please check what language you are using, and re-post in the appropriate forum.


I don't know what forum to put this in. It's a mixture of javascript, PHP, and HTML.

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.