How do i print HTML <SCRIPT> tag
How do i print HTML <SCRIPT> tag
(OP)
Hi,
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:
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- 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;
}
</SCRIPT>
but this doesn't:
<SCRIPT src="send_form.js"
LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
</SCRIPT>
Regards,
Hung
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:
<SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
<!-- 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;
}
</SCRIPT>
but this doesn't:
<SCRIPT src="send_form.js"
LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
</SCRIPT>
Regards,
Hung
RE: How do i print HTML <SCRIPT> tag
fortytwo
will@hellacool.co.uk
my test site
RE: How do i print HTML <SCRIPT> tag
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?
Wunderbar
RE: How do i print HTML <SCRIPT> tag
fortytwo
will@hellacool.co.uk
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"
LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT">
</SCRIPT>
try:
print "<SCRIPT src='send_form.js'
LANGUAGE=JAVASCRIPT TYPE='TEXT/JAVASCRIPT'>
</SCRIPT>";
always works for me :oÞ
RE: How do i print HTML <SCRIPT> tag
print "<SCRIPT src=\"send_form.js\" LANGUAGE=JAVASCRIPT TYPE=\"TEXT/JAVASCRIPT\">\n";
That should work.
-Vic
RE: How do i print HTML <SCRIPT> tag
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">~;
Mike
michael.j.lacey@ntlworld.com
Cargill's Corporate Web Site