webworxplus
10-09-2008, 04:20 PM
Good afternoon...
I am relatively new to working with javascript and am in need of some help with a problem I'm having. Here's what I'm trying to accomplish:
I have a page called modellist.htm with an iframe set up on it; I have a second page called models.htm with a link on it that when clicked opens modellist.htm with a specific url in the iframe that was passed from the link on models.htm. What's happening is that the link is not passing correctly and what I'm not sure of is if there is a limitation on the length of the url that can be passed..
Here's the code I've used:
modellist.htm
<script type="text/javascript">
function loadframe(){
if(window.location.replace)
window.frames.ModelFrame.location.replace(get('framepage'));
else
window.frames.ModelFrame.location.href=get('framepage');
}
function get(key_str) {
var query = window.location.search.substr(1);
var pairs = query.split("&");
for(var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
if(unescape(pair[0]) == key_str)
return unescape(pair[1]);
}
return null;
}
if (location.search&&get('framepage')!=null)
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", loadframe, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", loadframe );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
loadframe();
};
}
else
window.onload = loadframe;
}
</script>
</head>
<body>
<iframe name="ModelFrame" src="" width="800" height="800" frameborder="1"></iframe>
models.htm
<a href="modellist.htm?framepage=http://dealers.autouplinkusa.com/v/?DealerId=6083&LocationId=001&object=list&MAKE=Ford&MODEL=Focus&maxrows=24&MinYear=&MaxYear=2009&Type=N&MinPrice=&MaxPrice=&STYLE=&ExtColor=&MaxMiles=&StockNo=">Click Here</a>
Like I mentioned, I am new to this and maybe there is a better way to handle this so I am open to any and all suggestions. Thank you in advance for the help.
Mark
I am relatively new to working with javascript and am in need of some help with a problem I'm having. Here's what I'm trying to accomplish:
I have a page called modellist.htm with an iframe set up on it; I have a second page called models.htm with a link on it that when clicked opens modellist.htm with a specific url in the iframe that was passed from the link on models.htm. What's happening is that the link is not passing correctly and what I'm not sure of is if there is a limitation on the length of the url that can be passed..
Here's the code I've used:
modellist.htm
<script type="text/javascript">
function loadframe(){
if(window.location.replace)
window.frames.ModelFrame.location.replace(get('framepage'));
else
window.frames.ModelFrame.location.href=get('framepage');
}
function get(key_str) {
var query = window.location.search.substr(1);
var pairs = query.split("&");
for(var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
if(unescape(pair[0]) == key_str)
return unescape(pair[1]);
}
return null;
}
if (location.search&&get('framepage')!=null)
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", loadframe, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", loadframe );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
loadframe();
};
}
else
window.onload = loadframe;
}
</script>
</head>
<body>
<iframe name="ModelFrame" src="" width="800" height="800" frameborder="1"></iframe>
models.htm
<a href="modellist.htm?framepage=http://dealers.autouplinkusa.com/v/?DealerId=6083&LocationId=001&object=list&MAKE=Ford&MODEL=Focus&maxrows=24&MinYear=&MaxYear=2009&Type=N&MinPrice=&MaxPrice=&STYLE=&ExtColor=&MaxMiles=&StockNo=">Click Here</a>
Like I mentioned, I am new to this and maybe there is a better way to handle this so I am open to any and all suggestions. Thank you in advance for the help.
Mark