问题
Hello i have a little question.
How can i put iframe with google map in to html ?
<canvas id="google_map" width="600" height="400">
<iframe width="600" height="390" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src=""></iframe>
</canvas>
回答1:
you don't need to put map in the canvas try this....
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div style="width: 100%; margin-top: 50px;">
<iframe src="https://www.google.com/maps/embed?pb=!1m16!1m12!1m3!1d2965.0824050173574!2d-93.63905729999999!3d41.998507000000004!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!2m1!1sWebFilings%2C+University+Boulevard%2C+Ames%2C+IA!5e0!3m2!1sen!2sus!4v1390839289319" width="100%" height="200" frameborder="0" style="border:0"></iframe>
</div>
回答2:
Unfortunately you can't place an iFrame inside the Canvas tag. You could however use relative position to overlay your iFrame over the canvas element:
<style type="text/css">
canvas {
width: 600px;
height: 400px;
}
iframe {
position: relative;
top: -400px;
width: 600px;
height: 400px;
}
</style>
<canvas></canvas>
<iframe src=""></iframe>
One thing I have to say though is that using frame's is normally a sign of inexperience in web development. Your use of them could likely be circumvented.
来源:https://stackoverflow.com/questions/10514081/how-to-put-iframe-in-to-canvas