"Encountering a JavaScript Issue While Displaying an iFrame

Having trouble displaying an iframe on a ColdFusion website when passing values in the URL. A similar method worked fine on a non-ColdFusion site, so I suspect the issue is with ColdFusion itself. Unfortunately, I have no experience with ColdFusion.

If I share my code for pulling in the iFrame and values, I hope someone can assist me - any help would be highly 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 includes the following onLoad function:

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

and the iFrame is called as:

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

Using the provided url, you'll notice that the iframe doesn't appear:

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

Any obvious mistakes or recommended changes?

Answer №1

Firebug is indicating a JavaScript error:

document.getElementById("FIRSTNAME_FIELD") is null
[This error causes the script to break] documen...IELD').innerHTML = gup('firstname');

This error may be preventing the iframe from being created.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discover the hidden truth: Unveiling the enigma of React

I'm currently learning React and I've been working on some apps to enhance my skills and deepen my understanding. Right now, I am facing a challenge where I need to incorporate the logged user information into the Redux state. However, whenever I ...

Unlimited Lunch Options and Navigational Links

Looking for help with displaying the ul for MAINTENANCE and referencing specified classes from a CSS style sheet that are working elsewhere. However, the sub menu for MAINTENANCE is not showing up. Any suggestions? /* * Superfish v1.4.8 - jQuery menu w ...

What is the reason for labels appearing inside select boxes?

Can someone help me understand why my select box label is displaying inside the select box? For example, when I am not using react-material-validator it looks like this: https://codesandbox.io/s/5vr4xp8854 When I try to validate my select box using the r ...

calculating the total amount of continuous occurrences

I am trying to group consecutive repetitions of elements in a list. Here is the list: list = ['green','green','red','blue','red','blue','yellow','white','black',&apos ...

Spin the mergeometry object around its center in Three.js

I've been struggling to figure out how to rotate the object at its center. Right now, I can rotate the scene but the object moves away from the user. I've tried looking at similar questions on forums, but haven't been able to make it work. B ...

What is the best way to insert additional divs into a box div that contains tabs?

My current challenge is as follows: On a webpage, I have a box with jQuery tabs labeled "Enter" and "About" designed to switch the content displayed within the box. UPDATE: The jQuery script in use is shown below: <script type="text/javascript"> ...

Utilizing OrientDB in a SailsJS Application: A Step-by-Step Guide

I'm diving into the world of NodeJS and SailsJS after working with Rails and PHP. I'm interested in integrating SailsJS with OrientDB, but I'm unsure of the best approach to take. I've come across two options so far, but the available ...

Utilize React's debounce feature in conjunction with updating state using

Introduction Let's discuss the popular debounce function provided by lodash. Imagine a scenario where a user rapidly enters values like 1, 12, 123, 1234. The debounce function ensures that only one alert, with the final value 1234, is triggered afte ...

javascript incorrect calculation when adding days to a date

Using this code on my page to display upcoming dates for the next few days, but it's not functioning as expected: <script> var now = new Date(); var day = ("0" + (now.getDate()+3)).slice(-2); var day2 = ("0" + (now.getDate()+4)).sli ...

Prefixes for logging - Consider using the not-singleton technique or another approach

I am currently developing a logging helper for Node.JS that includes several exported functions such as error and warn. For instance, I have two other scripts called test1 and test2 which make use of this "module". When initializing my logging module us ...

What is the best way to retrieve JSON data using JavaScript within a loop?

I'm struggling to retrieve data from a JSON object. Here's the JSON structure I'm working with: var data = [ {"mes":{ "January":{ "Inversion":"1000","Fans":"1020"} ...

JavaScript - Uncaught ReferenceError: WebSocket is undefined

Looking at just the client side API (since each server side language has its own API), this code snippet demonstrates opening a connection, setting up event listeners for connect, disconnect, and message events, sending a message to the server, and closing ...

Issue Encountered during 'ng build --prod' Command: Prompt requesting addition of '@Pipe/@Directive/@Component annotation'

Encountered an error while running ng build --prod on my MEAN Stack App. The error message reads : ERROR in : Unexpected module 'FlashMessageModule in C:/mean/angular/node_modules/angular-flash-message/dist/flash-message.module.d.ts' declared ...

Issue: Unhandled ReferenceError - onChangeAssignedGroup function is not declared within scope at HTMLSelectElement.onchange

Having difficulty calling a PHP script via JavaScript when the user changes the value in the "Assigned To Group" selection. The goal is to modify the option list of a yet-to-be-created "Assign to User" selection. An error message pops up stating that it d ...

Is it possible to trigger an AJAX validation only after the jQuery validation plugin has successfully validated the input?

I utilized the jQuery validation plugin for form field validation. The goal now is to send an ajax request only when the fields are deemed valid by the jQuery validation plugin. JavaScript: $(function(){ $("#form").validate({ errorPlacement: ...

Using PHP and jQuery to populate a Bootstrap modal window with data

I am looking for a way to dynamically load data into a bootstrap modal box using JavaScript. Here is the JS code snippet: $(function() { $('.push').click(function() { var id = $(this).attr('id'); $.ajax({ ...

Convert a string in JavaScript by replacing spaces with '+' and use it as a link for a Google Search

I need to create a link to search Google with a specific text. To do this, I have to replace the spaces in the text with '+' and include it in the href attribute. Here is how it can be done in HTML: <a href="#" id="afd_gsearch">Search Goo ...

My attempt at deploying my personal React App project on Vercel was unsuccessful

// encountering error during deployment on Vercel npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @testing-library/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="e99b8c888a9da9d8da ...

Prevent further triggering of the .click function when the user clicks repeatedly

Is there a way to prevent the .click function from executing if the user clicks too many times? This is my current code: $('button').click(function() { $('#bg').fadeToggle('200'); }); Check out the jsfiddle DEMO ...

What is the methodology behind incorporating enumerations in typescript?

I've been curious about how typescript compiles an enumeration into JavaScript code. To explore this, I decided to create the following example: enum Numbers { ONE, TWO, THREE } Upon compilation, it transformed into this: "use strict ...