CodeIgniter Forums

Full Version: javascript help needed - please
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2

El Forum

[eluser]new_igniter[/eluser]
Hello,
I am having problems with something that appeared to be a simple task. Below is my javascript function, in which I am displaying a hidden div, which then has a link to display another hidden div within.
When I go to execute the 'showSomethingElse' function on the onclick, it says postID is not defined. So, how do I pass the postID passed into the showCreate function, so that I can call the showSomethingElse function correctly.

**it keeps removing the code ** Sad

Code:
function showCreate(postID)
{
   document.getElementById("new_container_" + postID).style.display = "block";
   document.getElementById("new_container_" + postJID)[removed] = "<a class="group_link_small" href="#">Create an album</a>";
}
showSomethingElse

El Forum

[eluser]Randy Casburn[/eluser]
Post the code without the &lt; script &gt; tags, that should allow us to see it.

Randy

El Forum

[eluser]new_igniter[/eluser]
I actually wasnt posting the script tags, just the function. It removes the innerHTML and the second function call. Perhaps this is the problem? I am trying to write a javascript function call through innerHTML. So I have this function, showCreate, seen above, and I want to write this onclick javascript function to show up in the div through innerHTML.
My problem is that I cant pass the value, passed in through the showCreate function, to the newly created function in the innerHTML

El Forum

[eluser]Randy Casburn[/eluser]
post it with a space thus: inner HTML - my brain is all twisted up. Must see the code.

El Forum

[eluser]new_igniter[/eluser]
yes, here is the code with spaces. Sorry for my confusing explanation.

Code:
function showCreate(postJID)
{
    document.getElementById("new_container_" + postJID).style.display = "block";
    document.getElementById("new_container_" + postJID). innerHTML = "<a >Create an album</a>";
}

El Forum

[eluser]new_igniter[/eluser]
arrggghhh!!!!! ok, let me try once more.

El Forum

[eluser]Randy Casburn[/eluser]
or attach a zipped up file and I'll look at it that way.

El Forum

[eluser]new_igniter[/eluser]
Code:
function showCreate(postJID)
{
    document.getElementById("new_container_" + postJID).style.display = "block";
    document.getElementById("new_container_" + postJID). innerHTML = "<a class="group_link_small" click = " showMore ( 'div_loc' + postJID); ">Create an album</a>";
}

El Forum

[eluser]new_igniter[/eluser]
ok that one is spaced on and the onclick is just click and the showMore function is all spaced out.

El Forum

[eluser]Randy Casburn[/eluser]
[never mind this post]
Pages: 1 2