• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

How do I display script samples in HTML pages

How do I display a sample script files in a HTML page.

Like for example I have the follow script code in a sample.wsf file. I would like to give a hyperlink to the sample.wsf file

Here is the code of the sample.wsf file

<job id="AdministrationInterface">
<?job debug="true"?>
   <script language="VBScript" src="..\\Common\\tss_values.vbs"/>
   <script language="VBScript" src="..\\Common\\HelperFunc.vbs"/>
   <script language="VBScript">
          On Error Resume Next

          'Create Context Object
          WScript.Echo "Create Context Object"
</script>
</job>

When I create a HTML page and try to give an hyperlink to this sample.wsf file it does not open I get a blank screen. Any way to get out of this problem ?
0
akalmani
Asked:
akalmani
  • 2
  • 2
1 Solution
 
Dean OBrienCommented:
Couple of messy ways of doing it;

 (i) Put the code into a text editor (i.e notepad) replace all '<' with '&lt;'.  This will ensure your server ignores your script tags.  You might also need to add some <BR>'s

 (ii) Else copy/paste your script into Frontpage or something(into normal). Then select HTML and it will have made the relevant changes for you.

(iii) save the script as a text file for viewing  

Your script:  (HTML Encoded)

<html><body>
<p>&lt;html>&lt;body>&lt;input type = button onclick = "location.href =  'history.go(-1)'" value = 'Back'>&lt;body>&lt;/html><br>
<br>
&lt;job id="AdministrationInterface"><br>
&lt;?job debug="true"?><br>
  &lt;script language="VBScript" src="..\\Common\\tss_values.vbs"/><br>
  &lt;script language="VBScript" src="..\\Common\\HelperFunc.vbs"/><br>
  &lt;script language="VBScript"><br>
         On Error Resume Next<br>
<br>
         'Create Context Object<br>
         WScript.Echo "Create Context Object"<br>
&lt;/script><br>
&lt;/job></p>
</html>

<job id="AdministrationInterface">
0
 
IeuanJCommented:
To place your script into a HTML file simply position the script between the <PRE> </PRE> tags.

<PRE>

<job id="AdministrationInterface">
<?job debug="true"?>
  <script language="VBScript" src="..\\Common\\tss_values.vbs"/>
  <script language="VBScript" src="..\\Common\\HelperFunc.vbs"/>
  <script language="VBScript">
         On Error Resume Next

         'Create Context Object
         WScript.Echo "Create Context Object"
</script>
</job>

</PRE>

I wouldnt bother with the linking directly to the file, it is messy and not necessary when you could just do as above.
0
 
Dean OBrienCommented:
I'm pretty sure the <script> tag would still be recognised by the browser, hence not showing up on the page.

might be wrong!
0
 
IeuanJCommented:
Actually you are correct Easy (many apologies to all has been a hard morning)

Try a text area instead.

<TEXTAREA COLS=60 ROWS=20>

<job id="AdministrationInterface">
<?job debug="true"?>
 <script language="VBScript" src="..\\Common\\tss_values.vbs"/>
 <script language="VBScript" src="..\\Common\\HelperFunc.vbs"/>
 <script language="VBScript">
        On Error Resume Next

        'Create Context Object
        WScript.Echo "Create Context Object"
</script>
</job>

</TEXTAREA>

There are more complex ways such as replacing all html specific charachters (<,>,",' etc) with ascii codes but normally this is not necessary.
0
 
akalmaniAuthor Commented:
Hi,
  After posting this question I got the answer myself. But I viewed the answer today. Yes ur answer is right.

Great thanks a lot !!

Avinash
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now