cudofcow
02-26-2010, 02:31 PM
So i'm trying to create a sharepoint web part via a Content Editor Web Part. I'm pasting in the following code. The purpose of the code is to be able to edit the &Date= + &EndDate= variables in the URL so that the page loads based on the current day. My function just gets the day, and formats it and shoves it into the url src of the iFrame.
The problem i'm running into is that i want to dynamically change the height of the iFrame based on the content. I've tried a few different approches and nothing seems to work. height="100%" doesnt work within the iframe tag. And the functions i've created using onLoad do not seem to work either. Does anyone have ideas for how to get this working?
here is the code i have so far:
<script langauge="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script language="javascript">
var $j=jQuery.noConflict();
$j(document).ready(function()
{
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
var formattedDate= curr_month + "/" + curr_date + "/" + curr_year;
$j("#myiframe").attr("src","http://www.whatever.asp?Date=" + formattedDate + "&EndDate=" + formattedDate + "&status=whatever");
});
</script>
<iframe id="myiframe" width="100%" scrolling="yes" frameborder="0"></iframe>
The problem i'm running into is that i want to dynamically change the height of the iFrame based on the content. I've tried a few different approches and nothing seems to work. height="100%" doesnt work within the iframe tag. And the functions i've created using onLoad do not seem to work either. Does anyone have ideas for how to get this working?
here is the code i have so far:
<script langauge="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
<script language="javascript">
var $j=jQuery.noConflict();
$j(document).ready(function()
{
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
curr_month++;
var curr_year = d.getFullYear();
var formattedDate= curr_month + "/" + curr_date + "/" + curr_year;
$j("#myiframe").attr("src","http://www.whatever.asp?Date=" + formattedDate + "&EndDate=" + formattedDate + "&status=whatever");
});
</script>
<iframe id="myiframe" width="100%" scrolling="yes" frameborder="0"></iframe>