[mayaa-user:519] 【質問】JavaScriptの引数にパラメータを渡す方法
Minako Kuroki
[E-MAIL ADDRESS DELETED]
2007年 6月 23日 (土) 12:18:37 JST
初めて質問させて頂きます。
黒木と申します。
早速ですが、質問させて頂きます。
社内システムカウント用のパラメータをJavaScriptの引数に渡し、
JavaScript内でURLを作成し、HTML内でJavaScriptを表示する
というような事を実装したいのですが、MayaaでScriptタグを書いて
パラメータを渡すことがうまくできません。
URL作成をJavaで行う方法がありますが、URLが頻繁に変更になる為、
あえて、Mayaa側で作成を行う方法をとってあります。
ファイルは、下記のよう書いて実行しましたが、うまくいきませんでした。
【実行ファイル】
<HTML>(Script表示時)
<html xmlns:m="http://mayaa.seasar.org" >
<head>
<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
</meta>
<title>test</title>
</head>
<body id="exec">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<script src="http://localhost:8080/hogehoge/id=xxxx&user=xxx">
</script>
</td>
</tr>
</table>
</body>
</html>
--------------------
<html xmlns:m="http://mayaa.seasar.org" >
<head>
<meta http-equiv="content-type" content="text/html; charset=Shift_JIS">
</meta>
<title>test</title>
</head>
<body id="exec">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<span id="test1">JavaScriptテスト</span>
</td>
</tr>
</table>
</body>
</html>
--------------------
<Mayaa>
<?xml version="1.0" encoding="UTF-8"?>
<m:mayaa xmlns:m="http://mayaa.seasar.org" m:noCache="true">
<m:exec id="exec" src="template/script/counter.js" encoding="UTF-8"
replace="false"/>
<m:element name="script" id="test1">
<m:attribute name="src" value="${count(${id}, ${user}); }" />
</m:element>
</m:mayaa>
--------------------
<counter.js>
function text(id,user) {
return 'http://localhost:8080/hogehoge/id=' + id + '&user=' + user;
}
何か回避方法などありましたら、教えてください。
宜しくお願い致します。
mayaa-user メーリングリストの案内