Click to See Complete Forum and Search --> : SSI inside of JavaScript
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?
I tried it both ways..It didn't work either way. Any other ideas?
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?
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.
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.
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.
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>
Which makes the code hard to read/modify. Expecially if you have a lot of code...
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.