Question: I've tried to run a simple "hello world" python script but in my browser it shows plain text and doesn't run.

```
    #!/usr/bin/python

    print "Content-type: text/html"
    print ""

    print "Hello, World"

```

But if I run it using a php exec function, the "Hello World" script runs.

```
    <?php
    echo exec('python hello.py');
    ?>

```

What am I missing to make the .py files run normally?
It's apache on Linux

Answer: 
The crudest solution would be to run it twice .. (*once for each `id`*)

```
onclick="toggle_visibility('first-id');toggle_visibility('second-id')"

```

---

Another would be to pass an array of id values

```
<script type="text/javascript">
function toggle_visibility(ids) {
    for(i=0,len = ids.length; i < len; i++) {
        var e = document.getElementById(ids[i]);
        if(e.style.display == 'block')
            e.style.display = 'none';
        else
            e.style.display = 'block';
    }
}
 </script>

```

And call it like this

```
onclick="toggle_visibility(['first-id','second-id']);"

```
By "make them switch" do you mean that hiding one always shows the other?

For starters, you'd need a reference to both elements when you call the function:

```
onclick="toggle_visibility('id_of_element_to_toggle', 'id_of_other_element');"

```

Then in your function it's just a matter of setting both of them:

```
function toggle_visibility(id1, id2) {
    var e1 = document.getElementById(id1);
    var e2 = document.getElementById(id2);
    if(e1.style.display == 'block')
        e1.style.display = 'none';
        e2.style.display = 'block';
    else
        e1.style.display = 'block';
        e2.style.display = 'none';
}

```

It's not terribly elegant, but should get the job done clearly and effectively. (With a potential added benefit that if by some other means the two elements get "out of sync" then this would re-sync them. Or a potential added bug of the same functionality, depending on how you look at it I suppose.)