开发者

ASP.NET object tag and JavaScript

开发者 https://www.devze.com 2023-02-01 13:15 出处:网络
i m using object tag on my .aspx page <object data=\"collapsibles.htm\" height=\"400\" width=\"300\" />

i m using object tag on my .aspx page

<object data="collapsibles.htm" height="400" width="300" />

in data attribute of object tag i refer the other HTML page on that HTML page one image that call the JavaScript function:

<img src="" alt="ipl" style="border: none" onClick="Cal()">

function Cal() {
    alert('hi All');
    var i = $("#txtMail").val();
    alert(i);
}

Here 'txtMail' control is on my aspx page. I access it in my HTML page but it 开发者_运维百科give it JvaScript error: 'undefined'.

My question is: how i can access this control on my HTML page?


Have such code instead:

var i = parent.document.forms[0].elements["txtMail"].value;

You must use parent to refer to the parent page.

ASP.NET might also generate different ID and name, check the HTML source of the .aspx and see what is the ID and name of the input field.

0

精彩评论

暂无评论...
验证码 换一张
取 消