我有一个联系我的盒子,是在一个PHP文件。 php在contact.html文件中运行。我的目标是,当有人将鼠标放在“提交”按钮上时,contact.html文件中的图像将会更改。提交按钮在php文件中。我如何做一个mouseover事件来改变contact.html文件中的图像的src?如何在PHP文件中使用JavaScript来更改父级HTML文件中的图像src?
在contact.html文件我有:
<img id = "me" src="Pictures/Image1.jpg" name="mypic">
<iframe src="contactform/contactform.php" frameborder='0' width='100%' height='600' ></iframe>
我一直在使用JavaScript是:
var image1=new Image()
image1.src="Pictures/Image1.jpg"
var image2=new Image()
image2.src="Pictures/Image2.jpg"
var image3=new Image()
image3.src="Pictures/Image4.jpg"
changepic1 = function() {
document.images.me.src=image1.src
}
changepic2 = function() {
document.images.me.src=image2.src
}
changepic3 = function() {
document.images.me.src=image3.src
}
而在PHP文件,我有:
<div class='container'>
<input type='submit' name='Submit' value='Submit' />
</div>