アプリ版:「スタンプのみでお礼する」機能のリリースについて

とあるサイトで中央に小窓表示JavaScriptを使用し
Another HTML-lint gatewayで文法チェックしたら
XHTMLでは <SCRIPT> や <STYLE> の内容が #PCDATA です。コメントはコメントとして解釈されてしまうので、旧来のテクニックは使えません。外部にスクリプトファイルやスタイルファイルを用意するようにしましょう。
とでました
下記のJavaScriptを外部形式にするにはxxx.jsに書くところまではわかりましたが書き方がわかりませんどこを変更したらいいのでしょうか
<script type="text/javascript"><!--
function m_win(url,windowname,width,height) {
var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
if (width) {
if (window.screen.width > width)
features+=", left="+(window.screen.width-width)/2;
else width=window.screen.width;
features+=", width="+width;
}
if (height) {
if (window.screen.height > height)
features+=", top="+(window.screen.height-height)/2;
else height=window.screen.height;
features+=", height="+height;
}
window.open(url,windowname,features);
}
// --></script>
よろしくお願いします

A 回答 (1件)

hoge.jsには、javascriptの中身だけを書きます



function m_win(url,windowname,width,height) {
var features="location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
if (width) {
if (window.screen.width > width)
features+=", left="+(window.screen.width-width)/2;
else width=window.screen.width;
features+=", width="+width;
}
if (height) {
if (window.screen.height > height)
features+=", top="+(window.screen.height-height)/2;
else height=window.screen.height;
features+=", height="+height;
}
window.open(url,windowname,features);
}
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!