vendredi 26 août 2016

Insert a javascript inside infoview Google Maps api

I was trying to learn google maps api. I read about the infoview, and tried to insert a script inside content of the infoview, like below:

var text="<form action='www.google.com' method ='get'>"+
            "<input type='image' src="+b+"  width='48' height='48'>"+
            "</form>"+
            "<h1>"+a+"</h1>"+ 
            "<script type='text/javascript'>alert('It's okay!')</script>";

but I get this error:

Uncaught SyntaxError: Invalid or unexpected token

on the line of the script, and when i try to execute the page, the browser show me the html code.

Could someone explain me why it happen ?




Aucun commentaire:

Enregistrer un commentaire