SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Zealot
    Join Date
    Sep 2002
    Posts
    180
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Quick Javascript Variable Question

    Hi All,

    In the following script I am using a variable named "template" passed through the function as a portion of an element id.
    PHP Code:
    function switchTemplate(templatename) {
    if (
    name == 'Header0'
    {
    template.value=document.theform(name).value;
    document.all.Selected template ID.value='Template Name';
    document.all.NewHeaderDiv.style.display='inline';
    document.all.SelectedHeaderDiv.style.display='none';
    doRenderHTML();

    else 
    {
    template.value=document.theform(name).value;
    document.all.NewHeaderDiv.style.display='none';
    document.all.SelectedHeaderDiv.style.display='inline';
    document.all.SelectedHeaderID.value=document.theform(name).id;
    doRenderHTML();
    }

    The attempt to use the variable is on this line:
    PHP Code:
    document.all.Selected template ID.value='Template Name'
    For example if template = Header, I need the above code to output:
    PHP Code:
    document.all.SelectedHeaderID.value='Template Name'
    How do I properly use the variable "template" in this situation?

    Thanks in advance,
    David
    Last edited by dcbraund; Aug 14, 2003 at 19:56.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •