Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How do i print HTML <SCRIPT> tag

How do i print HTML <SCRIPT> tag

How do i print HTML <SCRIPT> tag

  I've tried printing HTML code using a perl script. It works if I put the actually javascript inside the <SCRIPT> tags but if I link the script tag to a javascript file, I get an error "failed to execute send_form.js"
Anyone know how to fix this?

This works:
      <!-- Hide script from older browsers
      function isNum(passedvalue) {
        if (passedvalue == "")
  return true

for (n=0; n < passedvalue.length; n++) {
  if ((passedvalue.charAt(n) < "0") ¦¦ (passedvalue.charAt(n) > "9"))
    return false

return true;

but this doesn't:
 <SCRIPT src="send_form.js"


RE: How do i print HTML <SCRIPT> tag

Hi Hung, what error are you getting if any?  What happens when you run the script?

my test site

RE: How do i print HTML <SCRIPT> tag

Hi fortytwo,
   Basically, when i look at the error log, i get could not execute script. However, I've checked the read/write/execute permission and they are fine. I've ran the script fine using just an HTML file. Also,the javascript works fine if I use Perl and print the code of the javascript right right into the HTML page. But if I print the script tag with a "src=.." in it then the script fails. Is this because of my javascript or my Perl script?


RE: How do i print HTML <SCRIPT> tag

I would have thought it would have been because of your javascript.  The script should give the browser a valid html page that can then have the javascript analysed.

my test site

RE: How do i print HTML <SCRIPT> tag


the problem that i believe is the problem lies in the " . Perl is probably recognizing that and waiting for something to happen after or beofore it..instead of:

<SCRIPT src="send_form.js"


print "<SCRIPT src='send_form.js'

always works for me :oÞ

RE: How do i print HTML <SCRIPT> tag

Or, you could write it like this:

print "<SCRIPT src=\"send_form.js\" LANGUAGE=JAVASCRIPT TYPE=\"TEXT/JAVASCRIPT\">\n";

That should work.


RE: How do i print HTML <SCRIPT> tag

Nice tip from Tom Anderson about quoting:

Using qq~~; means that you don't have to escape the quotes.

For example, you could write this:

print "<input type=\"text\" name=\"$name\" value=\"$value\">";

or this:

print qq~<input type="text" name="$name" value="$value">~;

Cargill's Corporate Web Site

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close