html - iframe src to be massaged by javascript -
to novice in javascript insult novice. limited html knowledge self-taught. here's problem: trying massage src in simple iframe, so:
<html> <head> <script type="text/javascript"> function embedkey() { var url = window.location.href; var symbol = url.split('?')[1]; if(symbol=="inno"){ uniquekey = "&resid=27a14c5de396792c%21235&authkey=andfobkroksklqg" return "https://skydrive.live.com/embed?cid=27a14c5de396792c" + uniquekey +"&em=2&wdallowinteractivity=false&activecell='sheet1'!b3&wdhidegridlines=true&wdhideheaders=true" } else { alert(url); return false; } } </script> </head> <body> <iframe width="402" height="346" frameborder="0" scrolling="no" src=javascript:embedkey();></iframe> </body> </html>
i adding many more conditions/symbols/return strings embedkey() function. right now, trying make work one.
i don't think javascript gets executed src
attribute that. href
attribute on a
element (where 1 sees inline javascript) there's @ least click event respond to, not in case.
instead of trying call function inline element that, call script block after element has loaded. this:
<iframe width="402" height="346" frameborder="0" scrolling="no" id="someiframe"></iframe> <script type="text/javascript"> document.getelementbyid('someiframe').src = embedkey(); </script>
Comments
Post a Comment