Connecting Tech Pros Worldwide Forums | Help | Site Map

How to use packed js in <head> section so code executes?

Mike Scirocco
Guest
 
Posts: n/a
#1: Sep 13 '07
I've been asked to pack a very simple javascript function that resides
in the <headsection of a page. I have the function working the way I
want, but when I pack it using this packer:

http://joliclic.free.fr/php/javascri...r/en/index.php

it doesn't execute at all. My procedure:

1. enter javascript code between <script
type='text/javascript>...</scripttags into packer.

2. paste packed code between <script type='text/javascript>...</script>
tags in <headsection of page.

The code won't run. The code looks like this (shortened):

eval(function(p,a,c,k,e,d){e=function(c){return
c.toString(36)};if(!''.replace(/^/,String)){while(c
<snip>
noPop|if|function|var|location|n'.split('|'),0,{}) )

Is there something basic that I'm doing wrong?
Mike

Randy Webb
Guest
 
Posts: n/a
#2: Sep 13 '07

re: How to use packed js in <head> section so code executes?


Mike Scirocco said the following on 9/12/2007 9:20 PM:
Quote:
I've been asked to pack a very simple javascript function that resides
in the <headsection of a page. I have the function working the way I
want, but when I pack it using this packer:
>
http://joliclic.free.fr/php/javascri...r/en/index.php
>
it doesn't execute at all. My procedure:
>
1. enter javascript code between <script
type='text/javascript>...</scripttags into packer.
>
2. paste packed code between <script type='text/javascript>...</script>
tags in <headsection of page.
>
The code won't run. The code looks like this (shortened):
>
eval(function(p,a,c,k,e,d){e=function(c){return
The eval is part of your problem.
Quote:
c.toString(36)};if(!''.replace(/^/,String)){while(c
<snip>
noPop|if|function|var|location|n'.split('|'),0,{}) )
>
Is there something basic that I'm doing wrong?
From the looks of it, all the "packer" does (Deans anyway) is remove
whitespace. You probably have a missing ; somewhere. Try JSLint and
JSMin instead.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mike Scirocco
Guest
 
Posts: n/a
#3: Sep 13 '07

re: How to use packed js in <head> section so code executes?


Randy Webb wrote:
Quote:
Mike Scirocco said the following on 9/12/2007 9:20 PM:
Quote:
>I've been asked to pack a very simple javascript function that resides
>in the <headsection of a page. I have the function working the way I
>want, but when I pack it using this packer:
>>
>http://joliclic.free.fr/php/javascri...r/en/index.php
>>
>it doesn't execute at all. My procedure:
>>
>1. enter javascript code between <script
>type='text/javascript>...</scripttags into packer.
>>
>2. paste packed code between <script
>type='text/javascript>...</scripttags in <headsection of page.
>>
>The code won't run. The code looks like this (shortened):
>>
>eval(function(p,a,c,k,e,d){e=function(c){return
>
The eval is part of your problem.
>
Quote:
>c.toString(36)};if(!''.replace(/^/,String)){while(c
><snip>
>noPop|if|function|var|location|n'.split('|'),0,{} ))
>>
>Is there something basic that I'm doing wrong?
>
From the looks of it, all the "packer" does (Deans anyway) is remove
whitespace. You probably have a missing ; somewhere. Try JSLint and
JSMin instead.
Randy,

JSLint is very useful, I cleaned up my code and found a way to make it
work.

Thank You,
Mike
Closed Thread