Click to See Complete Forum and Search --> : IE6 and javascript problem.


rize92
December 14th, 2008, 01:40 PM
First of all please excuse my newbie code.. i don't expect this to be a big part of the site so i didn't code it the g o o d way because i really don't have knowledge on javascript..

My problem:

http://rize101.info/tolovero-friendster-layout/#more-3338

whenever trying to click on the "click here to get code" and "preview layout"
the javascript doesn't work in ie6, but works fine on firefox.

the <head></head>code:
<script language='javascript'>
function move(choice){
if(choice==1)
page='http://wikimyprofile.com/linker.php'
else
page='http://friendsterko.com/extras/convert/friendster-xover.php'
document.getElementById('formName').action=page
document.getElementById('formName').submit()}
</script>

the code within the body tags:
<center><img src="http://img403.imageshack.us/img403/6830/tolovero06162290617969nw5.jpg" border="0" width="300" height="150">
</center><br>
<!--more-->
<form name="formName" id="formName" method="post">

<input type="button" name="backBut" id="backBut" value="CLICK HERE TO GET CODE" onclick="javascript:move('1');">
<input type="button" name="confirmBut" id="confirmBut" value="Preview Layout" onclick="javascript:move('2');">
<textarea type="text" name="code" class="hide" rows="1" cols="1">http://boxstr.com/files/3561649_whehe/tolovero1.swf</textarea>
</form>

PeejAvery
December 14th, 2008, 07:33 PM
So, turn on IE's ability to display a script error and debug your code. It's under the last tab inside of the Internet Options.

rize92
December 14th, 2008, 08:37 PM
the error is: object doesn't support this property or code.. any help on debugging this?

PeejAvery
December 14th, 2008, 08:53 PM
It also gives you a line number. Find out on what line the error occurs. Then, you can analyze that code.

EDIT: I think I know your problem...You are passing a string as the parameter. Then, you check it as though it is a number. Use the following instead.

<input type="button" name="backBut" id="backBut" value="CLICK HERE TO GET CODE" onclick="move(1)">
<input type="button" name="confirmBut" id="confirmBut" value="Preview Layout" onclick="move(2)">

And you don't need the javascript: since the onclick even will already register as JavaScript in your page's scenario.

rize92
December 14th, 2008, 09:35 PM
i fixed it. the "page" conflicts with my css id page.. i had to make it
<script language='javascript'>
function move(choice){
if(choice==1)
page1='http://wikimyprofile.com/linker.php'
else
page1='http://friendsterko.com/extras/convert/friendster-xover.php'
document.getElementById('formName').action=page1
document.getElementById('formName').submit()}
</script>

to avoid conflict