-1

i am trying to open a feedback window and put some js code inside. this is what i did:

$('#feedback').click(function(){
 mw = window.open('','','width=560,height=460');
 mw.document.write('<html><head>');
 mw.document.write('<sc'+'ript type="text/javascript" src="{{STATIC_URL}}js/jquery-1.9.0.js"></scri'+'pt>');
 mw.document.write('<sc'+'ript type="text/javascript"> function feedbacken(){'+
             'var catg = $("#catg").text(); var feedback = $("#feedback").text(); alert(catg feedback);'
              +'}</scri'+'pt>');
 mw.document.write('</head><body>');
 mw.document.write('<div style="padding-left: 30px;">');
 mw.document.write('<br/> Bitte wählen Sie die Kategorie aus: <br/> ');
 mw.document.write('<select id="catg"><option>--</option><option>Technisch</option>   <option>Inhalt</option><option>Design</option></select>');
 mw.document.write('<br/><br/>Hier bitte Ihr Feedback:');
 mw.document.write('<p><textarea id="feedback" style="width:400px;height:100px"> </textarea></p>');
 mw.document.write('<button onclick="feedbacken()"> Jetzt absenden </button>');             
 mw.document.write('</div>');
 mw.document.write('</body></html>');
});

now, window is opening fine, but once i click the button, it is saying. feedbacken() function isnot defined.

can someone please hack this for me :)

this my feedback element:

<a id="feedback">Feedback</a>
4

3 回答 3

1
alert(catg feedback);

That's not valid. Try something like:

alert(catg);
alert(feedback);

or:

alert('catg: ' + catg + ', feedback: ' + feedback);

instead.

于 2013-04-13T15:21:55.453 回答
1

I don't know if this is the main error, but this would cause an error:

alert(catg feedback);

You could change it to:

alert(catg + feedback);
于 2013-04-13T15:25:05.753 回答
1

There are several problems.

alert(catg feedback)

should read...

 alert(catg, feedback)

Also, jQuery is not initialised in the new window.

于 2013-04-13T15:26:55.487 回答