前端事件只能依靠前端脚本来实现,PHP脚本不是用在前端的,而是用于后端. 所以没办法用PHP来实现JS事件的功能,最多就是用PHP输出JS代码到页面,最终还是以JS来执行.
script
(function?()?{
adpos.style.width?=?'?php?echo?$_POST['width']?';
adpos.style.padding?=?'?php?echo?$_POST['padding']?';
adpos.style.maxWidth?=?'?php?echo?$_POST['maxWidth']?';
adpos.style.textAlign?=?'center';
document.currentScript.parentNode.insertBefore(adpos,?document.currentScript.nextSibling);?
/script
form?method="post"
input?type="text"?name="width"?/
input?type="text"?name="padding"?/
input?type="text"?name="maxWidth"?/
button?type="submit"提交/button
/form
以上就是土嘎嘎小编为大家整理的利用php修改js代码相关主题介绍,如果您觉得小编更新的文章只要能对粉丝们有用,就是我们最大的鼓励和动力,不要忘记讲本站分享给您身边的朋友哦!!