0

I am passing values within a url to an iframe - on a coldfusion website. However, the iframe isn't appearing on the page. I have a method that I have used on a previous website, non-coldfusion, and this works perfectly - which leads me to believe that the issue is caused by the site being coldfusion. I have no experience with ColdFusion.

Hopefully, if I show you the code I am using to pull in the iFrame and values, somebody may be able to help me out - which would be greatly appreciated....

<script language="javascript">
function gup(name){
            name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
            var regexS = "[\\?&]"+name+"=([^&#]*)";
            var regex = new RegExp( regexS );
            var results = regex.exec( window.location.href );
            if( results == null ) return ""; else return unescape(results[1]);
}
function prepare() {           document.getElementById('EMAIL_FIELD').innerHTML = gup('email');
                               var email = gup('email');
                               document.getElementById('FIRSTNAME_FIELD').innerHTML = gup('firstname');
                               var firstname = gup('firstname');
                               document.getElementById('LASTNAME_FIELD').innerHTML = gup('lastname');
                               var lastname = gup('lastname');
                               document.getElementById('COUNTRY_FIELD').innerHTML = gup('country');
                               var country = gup('country');
                               document.getElementById('frame').innerHTML = "<iframe src='http://webe.emv3.com/tennisexpress/pref_center/Tennis_SP.html?email="+email+"&firstname="+firstname+"&lastname="+lastname+"&country="+country+"' width='750' scrolling='no' height='1000' frameborder='0' ></iframe>"; 
                             }

The body tag has the following onLoad function:

<body onLoad="javascript:prepare();">

and the iFrame is called as:

<div id="frame"></div>

if you use the following url, you will see that the iFrame is not shown:

http://www.tennisexpress.com/[email protected]&zipcode=11206&source=homepage&firstname=Gary&lastname=Rozanski&country=ny

Am I missing something obvious? Can anyone recommend any changes?

1 Answer 1

1

Firebug shows a JavaScript error:

document.getElementById("FIRSTNAME_FIELD") is null
[Переривати на цій помилці] documen...IELD').innerHTML = gup('firstname'); 

Possibly it's the reason of iframe not being created.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, I am trying to figure out what the issue is with the Javascript, but at the minute haven't spotted it yet ;(
Your js code is trying to get the values of elements that don't exist. FIRSTNAME_FIELD doesn't exist in the HTML.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.