...

View Full Version : sIFR Working in IE but not FF (using JS)



kraftomatic
08-09-2005, 10:43 PM
Hey All,

I've got the following code working in IE, but not FF. It's tied to the sIFR method, but that isn't the problem here. It's because of the script tags. What's the best way to encode the following?

<h3><script language="javascript">document.write("NAME" + varName);</script></h3>

Any suggestions would be much appreciated.

Thanks.

Mongus
08-10-2005, 03:18 AM
I'm not sure because you gave little to go on but is this what you're trying to do?


<script type="text/javascript">
var varName = " test";
document.write('<h3><script language="javascript">document.write("NAME" + varName);<' + '/script></h3>');
</script>

If so the reason it wasn't working is because the browser sees the </script> and thinks you forgot to terminate a string and it's at the end of the script. When you break it up into "<" and the "/script>" the browser doesn't recognize it as a closing tag.

kraftomatic
08-10-2005, 02:46 PM
Yep, that's exactly what I'm trying to do. However I tried what you listed and it didn't work . .

Hmm ..

Kor
08-10-2005, 03:30 PM
I don't get the poit... It works in FF as well

<h3><script type="text/javascript">document.write("NAME"+varName);</script></h3>

but the variable varName must be:
1. a global
2. set before runing the code

kraftomatic
08-10-2005, 04:37 PM
It is set up above ..

<script language="javascript">
var varName = "";
varName = getParameter('vehicleName');
</script>

That works and displays the actual varName value in IE. However in FF, it displays the actual JS "doc write .. " code ..

Mongus
08-10-2005, 04:58 PM
The code I posted works in Firefox and IE although there's not much point to it unless you're calling it in a loop or something.

getParameter() isn't a standard JavaScript function. Are you sure it is working in Firefox? Do you get any errors or warnings in the JavaScript console?

Maybe if you can post your whole page we can get a better idea of what is going wrong.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum