PDA

View Full Version : I need a bit of javascript help


kharris
11-11-2004, 08:00 PM
I have a flash movie that when you reach the end of it is launches a pop-up window based on the results of the information you were submitting. The flash file uses a seperate .as file to store the functions for the movie.

What I am wanting to know is how I can modify this page so that it goes to a new page instead of opening up a pop-up window.

Here is the code.

<code>

function checkProfile()
{

if(final[0] == "")
return "Error: Name is required.";

if(final[5] == "")
return "Error: Email Address is required.";


resultAs = emailCheck(final[5]);

if(!resultAs)
return resultAs;

return true;
}


function emailCheck(emailAddress)
{
if((emailAddress.indexOf("@") == -1 ) || (emailAddress.indexOf(".") == -1 ))
return "Error: Please Enter a Valid Email";
return true;
}


function sendData()
{

// RESET OUTPUT
output = "";

output += "'" + final[0] + "',"; // NAME
output += "'',"; // ADDRESS
output += "'',"; // CITY
output += "'',"; // STATE
output += "'',"; // ZIP
output += "'" + final[5] + "',"; // EMAIL
output += "'',"; // HANDICAP
output += "'',"; // UPDATES
output += "'" + final[8] + "',"; // SHAFTTYPE

// CONTROL/DISTANCE
if(final[9] <= 100 && final[9] >= 34)
weightNum = 1;
else if(final[9] <= 35 && final[9] >= -34)
weightNum = 2;
else if(final[9] <= -35 && final[9] >= -100)
weightNum = 3;

output += "'" + weightNum + "',";

// BALL FLIGHT (1,2,3)
output += "'" + final[10] + "',";

// DETERMINE FLEX (1,2,3,4,5)
speed = int(75 + ((200-final[11])/400) * (40))

// HERE IS THE SWING SPEED RANGE FOR WOODS
//////////////////////////////////////////
if (speed < 76){
output += "'" + 1 + "'";
}
else if (speed < 86){
output += "'" + 2 + "'";
}
else if (speed < 96){
output += "'" + 3 + "'";
}
else if (speed < 106){
output += "'" + 4 + "'";
}
else if (speed < 116){
output += "'" + 5 + "'";
}
else {
output += "'" + 3 + "'";
}



me ="javascript:ustResultWindow(" + output + ")";
getURL(me);

</code>

The line that confuses me most is this one: me="javascript:ustResultWindow("+output+")";

More specifically the - javascript:ustResultWindow - line

Ruben
11-11-2004, 09:18 PM
well probably there's a javascript-function writting in the html-file in which the swf is embedded, it would look somewhat like this (wild guess ;)):function ustResultWindow(zzz){
window.open(zzz);
}

ignore the "zzz", it varies...anyways, getURL("javascript:ustResultWindow('blabla');"); calls a javascript-function, getURL() is usually used to go to different webpages, but you can also use it to call javascript-functions with...

window.open() is the javascript-code for opening a new window (hey, I guess you kinda figured that one out yourself :D)...so if you want to open the webpage in the same window you gotta modify the function like this:function ustResultWindow(zzz){
window.document.href = zzz;
}

:) - Ruben