Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does this location.href function not work in an iframe?

Status
Not open for further replies.
Jun 9, 2006
159
US

Per the subject, this doesn't work in an iframe.

Code:
function album_go(albId) 
  {
      alert('Won't see this...');
      location.href = 'tray_photos.aspx?albumId='+albId;
   }


Shawn Molloy
Seattle, WA
 
It should be done like this
Code:
function album_go(albId) {
	alert('Won't see this...');
	window.location.href = 'tray_photos.aspx?albumId = ' + albId;
}

M. Brooks
 
Yeah great catch! Stupid mistake on my part....

Another reason why it wasn't working (and I was getting no error) was because, for some weird reason the calling function wasn't being recoginzed if typed like this:

<div onclick='album_go('4');'>

but when I changed it to the double quotes it was fine:

<div onclick="album_go('5');">




Shawn Molloy
Seattle, WA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top