使用jQuery更改不同域上iframe的文本框值? [英] Change text box value of an iframe on a different domain using jQuery?

查看:170
本文介绍了使用jQuery更改不同域上iframe的文本框值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我希望自动填充iframe中的电子邮件字段,其中包含以下内容:

querystring url(page.html?email = email)



我知道怎么做querystring的东西,我只是不确定如果我能够访问输入框架内的文本框。





<$>

。p $ p> $( email_frame)contents.find( '输入[名称=邮件')附加( 测试);

任何帮助都会很棒。

解决方案

如果IFRAME是从主页面以外的其他域加载的,则2 不能使用JavaScript或CSS进行交互。


I have an Iframe for a page that allows people to sign up for my email newsletters.

I want to auto fill the email field in the iframe based on the querystring url (page.html?email=email)

I know how to do the querystring stuff, I'm just not sure If I'm able to access the input text box within the frame. The form or the textbox neither have id's they only have names.

I've tried the following..

$("email_frame").contents.find('input[name=email]').append("test");

Any help would be great.

解决方案

If an IFRAME is loaded from a different domain than the main page, the 2 can't interact using JavaScript or CSS.

这篇关于使用jQuery更改不同域上iframe的文本框值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆