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!

need help with a code to work with Safari and Opera

Status
Not open for further replies.

madoo

IS-IT--Management
May 3, 2008
4
US
I have this code that dynamically changes a frame name and address and reloads it in the page. this code works for both firefox and IE but it doesn't for Safari and Opera. Is there a way I can make this code work with all browsers?

Code:
function changeName()
{
	var idPassed = this.id;
	var nameReceived = this.name.slice(0,-2);
	window.parent.frames['mediaPlayer'].name=idPassed;
	
	//checks to see which media plaer to load
	if (nameReceived.endsWith("F"))
	{
		window.parent.frames['mediaPlayer'].window.location="[URL unfurl="true"]http://mydomain/slideshow/firstmediaplayer.html";[/URL]
	}
	else
	{
		window.parent.frames['mediaPlayer'].window.location="[URL unfurl="true"]http://mydomain/slideshow/secondmediaplayer.html";[/URL]
	}
	
	
}
 
Perhaps because 'endsWith' is undefined?

Have you tried debugging this with alert statements to see if execution stops anywhere?

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Tech Snippets & Info:
 
the IF statement is not the problem. I actually added that later but it still works for Safari anyway. The problem is the method that I am using for changing the frame name and location. It seems as if Safari doesn't like using

window.parent.frames['framename']

both .name and .window.location doesn't function under Safari and Opera. I guess there must be a different method that I have to use for those two browsers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top