Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Invalid character Line: 1 Char:1 Code: 0
Old 11-22-2010, 11:40 AM Invalid character Line: 1 Char:1 Code: 0
Novice Talker

Posts: 5
Trades: 0
Hi Everyone,

So glad that I found this forum dedicated to javascript solutions and expertise. I am hoping that someone can help me as I am still a beginner with using javascript. It really is some great stuff!

I have some drop down list boxes on a form and a check box. When the check box is clicked, it enables the list boxes so they can be selected, otherwise they are deselected. The script seem to be working just fine.

Then recently, I upgrade my browser to IE8 and began getting this error, though I cannot see what the issue is really. The file location (URI) exists as I pasted that into the browser and it wanted to download it, so I know the path is correct to the file.

Message: Invalid character
Line: 1
Char: 1
Code: 0

I opened the file, but cannot see any invalid characters with it. Here is the script:
Code:
 
function toggleInputs(daCheckbox,rowNumber){
var disabled = ! daCheckbox.checked
document.getElementById("LIST1_"+rowNumber).disabled = disabled
document.getElementById("LIST2_"+rowNumber).disabled = disabled
document.getElementById("LIST3_"+rowNumber).disabled = disabled
}
Note: For some reason when I paste the script here, the disabled comes out to be disabl ed (with a space) though I am not pasting it that way.


Thank you for any help or assistance with this.

Steven

Last edited by chrishirst; 11-22-2010 at 12:28 PM..
stevenmac2 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-22-2010, 12:00 PM Re: Invalid character Line: 1 Char:1 Code: 0
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Use the javascript debugger in Firefox or Seamonkey to get some meaningful error messages instead of the obtuse and misleading IE messages.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-22-2010, 12:11 PM Re: Invalid character Line: 1 Char:1 Code: 0
Novice Talker

Posts: 5
Trades: 0
Okay, FireFox says the following:

Error: toggleInputs is not defined

This is how I am calling it:
<input type="checkbox" onclick="toggleInputs(this,1)>


This is how I have it defined in the HTML

HTML Code:
<script type="text/javascript" src="C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test\js\disable.js">
</script>

Last edited by chrishirst; 11-22-2010 at 12:34 PM..
stevenmac2 is offline
Reply With Quote
View Public Profile
 
Old 11-22-2010, 12:31 PM Re: Invalid character Line: 1 Char:1 Code: 0
Novice Talker

Posts: 5
Trades: 0
okay, I think I found the issue that wasn't syntax related.

What I did was remove referencing the external file and copied the script so that it was directly hardcoded. It worked like that.

It could be something with the apache server not able to see the file? But I need to keep the code stored in each .js file for security and maintenance easier.
stevenmac2 is offline
Reply With Quote
View Public Profile
 
Old 11-22-2010, 12:35 PM Re: Invalid character Line: 1 Char:1 Code: 0
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
because the apache server doesn't have a path of

C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test\js\disable.js

to the file THAT will only work on your machine.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-22-2010, 02:56 PM Re: Invalid character Line: 1 Char:1 Code: 0
Novice Talker

Posts: 5
Trades: 0
So I assume instead of a direct path, that really it needs to be called through the HTTP:\\www.xxx.xxx\mypath\js\disable.js so the engine can serve it up to any client calling? I will try that to see what I get. The weird part is that previously I had no issues.

I did have to reload my development environment. Maybe it is possible that I specified a path in the configuration, but it should have carried over as I reloaded the same backup files.

Last edited by stevenmac2; 11-22-2010 at 02:57 PM..
stevenmac2 is offline
Reply With Quote
View Public Profile
 
Old 11-22-2010, 03:58 PM Re: Invalid character Line: 1 Char:1 Code: 0
Novice Talker

Posts: 5
Trades: 0
I am able to reference the js file by accessing through the webserver by calling http://www.xxx.xxx/test/js/disable.js

The only problem is now, if I paste that into the address bar, it allows me to download the file. I don't want to necessarily want folks to be able to see inside of these files for more complex things later that give inside references about the system. How can I prevent that from being accessed?

Is there another method I need to choose in order to use js while meeting some sort of security requirement?
stevenmac2 is offline
Reply With Quote
View Public Profile
 
Old 11-22-2010, 06:21 PM Re: Invalid character Line: 1 Char:1 Code: 0
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
How can I prevent that from being accessed?
You can't. javascript is processed on the client machine so HAS to be downloaded.

just using a root relative path is sufficient
HTML Code:
<script type="text/javascript" src="/test/js/disable.js"></script>
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-26-2010, 08:43 AM Re: Invalid character Line: 1 Char:1 Code: 0
alexsts's Avatar
Novice Talker

Posts: 14
Name: Alex
Location: USA
Trades: 0
Do google search for encryption of html files.
There are lot of small programs free for use which will encode your JS files the way that code will basically look like a jebrish but parse normally.
alexsts is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Invalid character Line: 1 Char:1 Code: 0
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47603 seconds with 12 queries