Link to home
Start Free TrialLog in
Avatar of akalmani
akalmani

asked on

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 ?
ASKER CERTIFIED SOLUTION
Avatar of Dean OBrien
Dean OBrien
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of IeuanJ
IeuanJ

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.
I'm pretty sure the <script> tag would still be recognised by the browser, hence not showing up on the page.

might be wrong!
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.
Avatar of akalmani

ASKER

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