?
Solved

How do I display script samples in HTML pages

Posted on 2003-03-27
5
Medium Priority
?
214 Views
Last Modified: 2010-04-09
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
Comment
Question by:akalmani
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 12

Accepted Solution

by:
Dean OBrien earned 75 total points
ID: 8216862
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
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8217276
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
 
LVL 12

Expert Comment

by:Dean OBrien
ID: 8217328
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
 
LVL 2

Expert Comment

by:IeuanJ
ID: 8217361
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
 
LVL 3

Author Comment

by:akalmani
ID: 8222701
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question