---------- This is the page code that loads in the iframe ------
<HTML>
<HEAD>
<script language=vbscript>
function TestIt()
dim d
d=window.parent.document.forms(0).frmTxtText.value
msgbox d
end function
</script>
</HEAD>
<BODY>
<BR>
<BR>
<FORM ID=FormTest2>
<input ID=frmbut type=button value="test" onclick='TestIt()'>
</FORM>
</BODY>
</HTML>
------------------------------------------------------------
Just create these 2 html files to see how it works.
The code you really want is vbscript:
function TestIt()
dim d
d=window.parent.document.forms(0).frmTxtText.value
msgbox d
end function
The javascript would look like (works in IE and Netscape6.0^:
function TestIt(){
var d=window.parent.document.getElementById("frmTxtText".value
alert(d);
} "did you just say Minkey?, yes that's what I said."
Using the VBScript example, how can you access the variable 'd' in asp after the function was called?
I thought that vbscript was part of asp, so it seems to me that the variable 'd' should be available inside an asp tag..
does this make sense...
In other words, if I do:
<script language=vbscript>
dim d
d=window.parent.document.forms(0).frmTxtText.value
</script>
<%=d%>
why isn't the variable 'd' available in side a asp tag? Dont vbscript variables reside within or aren't they made available to asp? (I was assuming since you can use vbscript within asp tags that this was possible, however using the d=window.parent.document.forms(0).frmTxtText.value
inside of asp does not work).
VBScript is the language used by ASP, but when VBScript is on the client side (between script tags), an ASP page cannot access the client side variables or functions.
If you want to be able to access the variable "d". Then you would have to set a hidden field on a form and place the value "d" in it then when you "run" your ASP page it can grab the value from the hidden form field. <-- that is the only way I know of how to grab the variable other than explicitly passing the "d" variable(value) in the url to the ASP page. "did you just say Minkey?, yes that's what I said."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.