...

View Full Version : Character Setting in using JS format file



joonstar
04-16-2005, 10:07 AM
sure.js

function sure(){
msg = "Are you sure to delete?";
return confirm(msg);
}

form.cfm

<script type="text/javascript" src="sure.js"></script>

<form action="action.cfm" method="post" onSubmit="return sure()" >

<input name="passWord"
value=""
type="password"
size="16"
maxlength="16"> &nbsp;


<input type="submit" value=" Password Submit ">

</form>



If a user clicks the submit button after he browses form.cfm,
It will say "Are you sure to delete?

The above code works fine for that.


Let's change the above code like the following.

sure.js

function sure(){
msg = "123456789?";
return confirm(msg);
}

form.cfm

<script type="text/javascript" src="sure.js"></script>

<form action="action.cfm" method="post" onSubmit="return sure()" >

<input name="passWord"
value=""
type="password"
size="16"
maxlength="16"> &nbsp;


<input type="submit" value=" Password Submit ">

</form>


If a user clicks the submit button after he browses form.cfm,
It will say "123456789?

The above code works fine for that.



Now the following code is my problem.


sure.js

function sure(){
msg = "Korean Characters?";
return confirm(msg);
}

form.cfm

<script type="text/javascript" src="sure.js"></script>

<form action="action.cfm" method="post" onSubmit="return sure()" >

<input name="passWord"
value=""
type="password"
size="16"
maxlength="16"> &nbsp;


<input type="submit" value=" Password Submit ">

</form>


If a user clicks the submit button after he browses form.cfm,
I expect it saying "Korean Characters?

But the Korean Characters are broken in fact.


In conclusion,
English Characters are fine with the above code.
Numeral Characters are fine with the above code.
But Korean Characters are not fine with the above code.


If I make the above two files(surejs and form.cfm) into one file(form.cfm) like the following, it works fine with Korean Characters.


form.cfm

<script type="text/javascript">

function sure(){
msg = "Are you sure?";
return confirm(msg);
}

</script>

<form action="delete.cfm?" method="post" onSubmit="return sure()" >

<input name="passWord"
value=""
type="password"
size="16"
maxlength="16"> &nbsp;

<input type="submit" value=" Password Submit ">

</form>

I guess there might be something like Character Setting inside sure.JS or somewhere.

Although I can make the Korean Characters fine with the just above code,
I like to know how I set Korean Character in using JS file.

For example, the following is the Korean Character Setting in every HTML page.


<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">

glenngv
04-18-2005, 02:07 PM
This (http://www.codingforums.com/showthread.php?t=48090) will give you an idea.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum