Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

claybaby on "javascript fail to load"

$
0
0

I'm using some javascript written by a previous site-builder for an html site. I did get it to work in the past, but something changed and I can't get the javascript file to load and work. The path to the file appears correct, but the console says "failed to load..."

I tried to load the file within the post and in the header, neither worked.

The javascript file contains a function like this:

var co = new Object;
function recalc_onclick(ctl) { if...etc

In the codex it says

For the occasional or one time use of JavaScript, you need to put the script into a JavaScript file, and then call it out from within the post. Make sure that each script is defined by its function name, such as:

I'm not sure what that means?

the function is called within the post like this

<script language="javascript" type="text/javascript">
 function reset_onclick(x){document.formc.reset();postcode();recalc_onclick('');};function postcode(){document.formc.p3C45.value="John/Jane Doe";document.formc.p3C46.value="Company Name";document.formc.p3C47.value="email @ domain.com";};function eequerystring(){var querystring=document.location.search;if(querystring.length>0){variables=(querystring.substring(1)).split("&");var variable;var key;var value;for(var ii=0;ii<variables.length;ii++){variable=variables[ii].split("=");key=unescape(variable[0]);value=unescape(variable[1]);if(document.formc[key]!=null){document.formc[key].value=value;}}}}function initial_update(){postcode('');eequerystring();recalc_onclick('');}
</script>

It's doing a whole bunch of math to fill in a table based on input values(there are some default values).


Viewing all articles
Browse latest Browse all 8245

Trending Articles