Click to See Complete Forum and Search --> : SSI inside of JavaScript


pyro
12-11-2002, 05:48 PM
Does anyone know how to use SSI inside of JavaScript? I tried this script and it didn't work
<Script Language="JavaScript">
document.write("<!--#exec cgi=\"cgi-bin/poll.cgi\" -->");
</Script>

Any ideas how I can do this?

pyro
12-11-2002, 06:02 PM
I tried it both ways..It didn't work either way. Any other ideas?

pyro
12-11-2002, 11:36 PM
Yes, it was .shtml. Do you know if it can be done? It seems like it should work. Isn't a document.write suppose to just print whatever is inside it on the page?

pyro
12-12-2002, 12:44 AM
Yes, I know everything is working fine, except for the JavaScript. I can make a plain SHTML page with the SSI in it and it works just fine.

pyro
12-12-2002, 12:57 AM
I thought of something else...Is there a way to make a JavaScript run a CGI script? That is what I was doing with the SSI, so I can do that with a JavaScript, it should work just as well for this purpose.

pyro
12-12-2002, 11:40 AM
For future reference, the following code displayed the SSI

<script language="JavaScript">
document.write("<!--#exec cgi='cgi-bin/poll.cgi'-->");
</script>

The only problem with this is it uses the document.write, so if you have more than 1 line of HTML to dispaly, you out of luck. There would be work arounds, but I decided to use the IFRAME.

pyro
12-15-2002, 08:07 PM
Yeah, it did. It seems that if you start with double, you inner one need to be single, and if you start with single, your inner ones need to be double.

What I meant about the document.write is that you need to have all you code on one line inside the document.write. Not exactly condusive to copying large amounts of code in. I know that you can use <br> or <p>

pyro
12-15-2002, 09:30 PM
Which makes the code hard to read/modify. Expecially if you have a lot of code...

pyro
12-15-2002, 09:52 PM
I needed to use a document.write because I was using JavaScript for a menu and wanted to add a CGI poll inside of the menu. The menu slides up and down to reveal/hide sublinks. I wanted the poll to slide with the rest of the menu.