Toxhicide
12-12-2010, 09:29 PM
When I click my button, window.frames['akFrame'].document.getElementsByName('auth_key').value is undefined, and I cant seem to make the if else statement work.
<script type='text/javascript'>
url=location.href.split('/')[4];
url=location.href.replace(url,'')
if(url.charAt(url.length-1)!= '/'){
url = url + '/'
}
Content = "<iframe width='0' height ='0' name='akFrame' id='akFrame' src='file:///C:/Users/Alec/Desktop/ffaa.html' style='display:none'></iframe>"
function asdf(){
authenKey = window.frames['akFrame'].document.getElementsByName('auth_key')[0].value
if (authenKey)
{
document.getElementById('a').value = url + "&auth_key="+authenKey+"&good=true"
}
else
{
document.getElementById('a').value = url + "&auth_key=00&good=true"
}
}
function apple(){
document.getElementById('d').innerHTML = '<iframe src="" name="c" id="c"></iframe>'
}
document.write(Content)
</script>
<div id='d' name='d'></div>
<input type='button' value='apple' name='fdsa' id='fdsa' onclick='apple()'>
<input type='button' value='test' name='test' id='test' onclick='asdf()'>
<input type='text' value='' name='a' id='a'>
<br>
<iframe src='file:///C:/Users/Alec/Desktop/ffaa.html' name='b' id='b'>
<script type='text/javascript'>
url=location.href.split('/')[4];
url=location.href.replace(url,'')
if(url.charAt(url.length-1)!= '/'){
url = url + '/'
}
Content = "<iframe width='0' height ='0' name='akFrame' id='akFrame' src='file:///C:/Users/Alec/Desktop/ffaa.html' style='display:none'></iframe>"
function asdf(){
authenKey = window.frames['akFrame'].document.getElementsByName('auth_key')[0].value
if (authenKey)
{
document.getElementById('a').value = url + "&auth_key="+authenKey+"&good=true"
}
else
{
document.getElementById('a').value = url + "&auth_key=00&good=true"
}
}
function apple(){
document.getElementById('d').innerHTML = '<iframe src="" name="c" id="c"></iframe>'
}
document.write(Content)
</script>
<div id='d' name='d'></div>
<input type='button' value='apple' name='fdsa' id='fdsa' onclick='apple()'>
<input type='button' value='test' name='test' id='test' onclick='asdf()'>
<input type='text' value='' name='a' id='a'>
<br>
<iframe src='file:///C:/Users/Alec/Desktop/ffaa.html' name='b' id='b'>